package com.devjob.dto;

import com.devjob.domain.Application;
import com.devjob.domain.ApplicationStatus;
import java.time.LocalDateTime;

public record ApplicationResponse(
        Long id,
        Long jobId,
        String jobTitle,
        String companyName,
        ApplicationStatus status,
        LocalDateTime createdAt
) {
    public static ApplicationResponse from(Application application) {
        return new ApplicationResponse(
                application.getId(),
                application.getJob().getId(),
                application.getJob().getTitle(),
                application.getJob().getCompany().getName(),
                application.getStatus(),
                application.getCreatedAt()
        );
    }
}
