package com.njzscloud.common.sichen.support;

import cn.hutool.core.date.DateUtil;
import com.njzscloud.common.sichen.contant.ScheduleType;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

@Setter
@Getter
@Slf4j
@Accessors(chain = true)
public class TaskInfo {
    private Long id;
    private String memo;
    private String fn;
    private ScheduleType scheduleType;
    private String scheduleConf;
    private Long criticalTiming;


    public TaskInfo() {
    }

    public TaskInfo(TaskInfo taskInfo) {
        id = taskInfo.id;
        memo = taskInfo.memo;
        fn = taskInfo.fn;
        scheduleType = taskInfo.scheduleType;
        scheduleConf = taskInfo.scheduleConf;
        criticalTiming = taskInfo.criticalTiming;
    }

    @Override
    public String toString() {
        return "TaskInfo{" +
                "id=" + id +
                ", memo='" + memo + '\'' +
                ", fn='" + fn + '\'' +
                ", scheduleType=" + scheduleType +
                ", scheduleConf='" + scheduleConf + '\'' +
                ", criticalTiming=" + DateUtil.formatDateTime(new Date(criticalTiming * 1000)) +
                '}';
    }
}
