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.ArStepRecord;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;

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

/**
 * 步骤执行记录视图对象 ar_step_record
 *
 * @author Lion Li
 * @date 2025-01-13
 */
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ArStepRecord.class)
public class ArStepRecordVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 记录ID
     */
    @ExcelProperty(value = "记录ID")
    private Long id;

    /**
     * 任务执行ID
     */
    @ExcelProperty(value = "任务执行ID")
    private Long executionId;

    /**
     * 步骤ID
     */
    @ExcelProperty(value = "步骤ID")
    private Long stepId;

    /**
     * 状态
     */
    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
    @ExcelDictFormat(readConverterExp = "pending=待执行,completed=已完成,skipped=已跳过")
    private String status;

    /**
     * 是否完成
     */
    @ExcelProperty(value = "是否完成", converter = ExcelDictConvert.class)
    @ExcelDictFormat(readConverterExp = "0=否,1=是")
    private String isDone;

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

    /**
     * 完成时间
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "完成时间")
    private Date completionTime;

    /**
     * 耗时(秒)
     */
    @ExcelProperty(value = "耗时(秒)")
    private Integer duration;

    /**
     * 文本反馈
     */
    @ExcelProperty(value = "文本反馈")
    private String textFeedback;

    /**
     * 语音识别文本
     */
    @ExcelProperty(value = "语音识别文本")
    private String voiceText;

    /**
     * AI识别结果(JSON)
     */
    private String aiResult;

    /**
     * 执行人ID
     */
    private Long executorId;

    /**
     * 执行人姓名
     */
    @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "executorId")
    @ExcelProperty(value = "执行人")
    private String executorName;

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

}
