package com.devjob.application.dto;

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

public record ApplicationResponse(
        Long id,
        Long jobId,
        String jobTitle,
        String companyName,
        ApplicationStatus status,
        LocalDateTime createdAt
) {
    public static ApplicationResponse of(Application application, JobInfo job) {
        return new ApplicationResponse(
                application.getId(),
                application.getJobId(),
                job.title(),
                job.companyName(),
                application.getStatus(),
                application.getCreatedAt()
        );
    }
}
