package com.ruoyi.ems.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.huashe.common.annotation.Excel;
import com.huashe.common.domain.BaseEntity;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 巡检计划对象 adm_op_inspection_plan
 *
 * 【修改说明】新增调度相关字段：scheduleEnabled, lastExecTime, nextExecTime, execCount
 */
@Data
public class InspectionPlan extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private Long id;

    @Excel(name = "归属区域代码")
    private String areaCode;

    private String areaName;

    @Excel(name = "计划代码")
    private String planCode;

    @Excel(name = "计划名称")
    private String planName;

    @Excel(name = "计划类型", readConverterExp = "1=手动巡检,2=自动巡检")
    private Integer planType;

    @Excel(name = "计划状态", readConverterExp = "0=待执行,1=执行中,2=已完成,3=已取消")
    private Integer planStatus;

    @Excel(name = "巡检目标类型", readConverterExp = "0=区域,1=设施,2=设备")
    private Integer targetType;

    private String targetCodes;

    @Excel(name = "巡检目标")
    private String targetNames;

    /** Cron表达式(自动巡检用) */
    private String cronExpression;

    /** 是否启用调度 0:禁用 1:启用 */
    @Excel(name = "调度状态", readConverterExp = "0=禁用,1=启用")
    private Integer scheduleEnabled;

    /** 上次执行时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "上次执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date lastExecTime;

    /** 下次执行时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "下次执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date nextExecTime;

    /** 累计执行次数 */
    @Excel(name = "执行次数")
    private Integer execCount;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "计划执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date planTime;

    @Excel(name = "执行人")
    private String executor;

    private String description;

    /** 巡检规则列表 */
    private List<InspectionRule> rules;

    /** 解析后的目标代码列表 */
    private List<String> targetCodeList;
}