package com.devjob.job.dto;

import com.devjob.job.domain.Job;
import com.devjob.job.domain.JobStatus;
import java.time.LocalDate;
import java.time.LocalDateTime;

public record JobResponse(
        Long id,
        Long companyId,
        String companyName,
        Long registeredBy,
        String title,
        String description,
        Integer salary,
        JobStatus status,
        LocalDate deadline,
        LocalDateTime updatedAt
) {
    public static JobResponse from(Job job) {
        return new JobResponse(
                job.getId(),
                job.getCompany().getId(),
                job.getCompany().getName(),
                job.getRegisteredBy(),
                job.getTitle(),
                job.getDescription(),
                job.getSalary(),
                job.getStatus(),
                job.getDeadline(),
                job.getUpdatedAt()
        );
    }
}
