package com.spring.domain.schedule.dto;

import java.time.LocalDateTime;

import com.spring.domain.schedule.entity.BatchJobExecution;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class BatchJobHistoryResponse {

    private final String jobName;
    private final LocalDateTime startTime;
    private final LocalDateTime endTime;
    private final String status;

    public static BatchJobHistoryResponse fromEntity(BatchJobExecution batch) {
        return new BatchJobHistoryResponse(batch.getJobInstance().getJobName(), batch.getStartTime(), batch.getEndTime(), batch.getStatus());
    }

}
