package org.dromara.inspection.domain.vo;

import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArExecution;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 任务执行记录视图对象 ar_execution
 *
 * @author Lion Li
 * @date 2025-01-13
 */
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ArExecution.class)
public class ArExecutionVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 执行ID
     */
    @ExcelProperty(value = "执行ID")
    private Long id;

    /**
     * 任务模板ID
     */
    @ExcelProperty(value = "任务模板ID")
    private Long taskId;

    /**
     * 执行编号
     */
    @ExcelProperty(value = "执行编号")
    private String executionCode;

    /**
     * 区域ID
     */
    @ExcelProperty(value = "区域ID")
    private Long regionId;

    /**
     * 使用设备ID
     */
    @ExcelProperty(value = "使用设备ID")
    private Long deviceId;

    /**
     * 操作人ID
     */
    private Long operatorId;

    /**
     * 操作人姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "operatorId")
    @ExcelProperty(value = "操作人")
    private String operatorName;

    /**
     * 监护人ID
     */
    private Long custodianId;

    /**
     * 监护人姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "custodianId")
    @ExcelProperty(value = "监护人")
    private String custodianName;

    /**
     * 发令人ID
     */
    private Long senderId;

    /**
     * 发令人姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "senderId")
    @ExcelProperty(value = "发令人")
    private String senderName;

    /**
     * 收令人ID
     */
    private Long recipientId;

    /**
     * 收令人姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "recipientId")
    @ExcelProperty(value = "收令人")
    private String recipientName;

    /**
     * 值长ID
     */
    private Long commanderId;

    /**
     * 值长姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "commanderId")
    @ExcelProperty(value = "值长")
    private String commanderName;

    /**
     * 状态
     */
    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
    @ExcelDictFormat(readConverterExp = "pending=待执行,in_progress=执行中,completed=已完成,cancelled=已取消")
    private String status;

    /**
     * 开始时间
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "开始时间")
    private Date startTime;

    /**
     * 结束时间
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "结束时间")
    private Date endTime;

    /**
     * 总步骤数
     */
    @ExcelProperty(value = "总步骤数")
    private Integer totalSteps;

    /**
     * 已完成步骤数
     */
    @ExcelProperty(value = "已完成步骤数")
    private Integer completedSteps;

    /**
     * 创建时间
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "创建时间")
    private Date createTime;

}
