package org.dromara.elevator.domain.bo;

import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.elevator.constant.ElevatorConstant;
import org.dromara.elevator.domain.EFaultStatistics;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * 故障统计业务对象 e_fault_statistics
 *
 * @author ym
 * @date 2024-09-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = EFaultStatistics.class, reverseConvertGenerate = false)
public class EFaultStatisticsBo extends BaseEntity {

    /**
     * 主键ID
     */
    @NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
    private Long id;

    /**
     * 注册代码
     */
    @NotBlank(message = "注册代码不能为空", groups = { AddGroup.class, EditGroup.class })
    private String registerCode;

    /**
     * 电梯编号
     */
    @NotBlank(message = "电梯编号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String elevatorNum;

    /**
     * 电梯名称
     */
    @NotBlank(message = "电梯名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String elevatorName;

    /**
     * 终端编号
     */
    @NotBlank(message = "终端编号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String deviceCode;

    /**
     * 物业单位id
     */
    @NotBlank(message = "物业单位id不能为空", groups = { AddGroup.class, EditGroup.class })
    private String tenementId;

    /**
     * 物业单位名称
     */
    @NotBlank(message = "物业单位名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String tenementName;

    /**
     * 维保单位id
     */
    @NotBlank(message = "维保单位id不能为空", groups = { AddGroup.class, EditGroup.class })
    private String maintenanceId;

    /**
     * 维保单位名称
     */
    @NotBlank(message = "维保单位名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String maintenanceName;

    /**
     * 故障编号
     */
    @NotBlank(message = "故障编号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String faultCode;

    /**
     * 故障名称
     */
    @NotBlank(message = "故障名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String faultName;

    /**
     * 故障数量
     */
    @NotNull(message = "故障数量不能为空", groups = { AddGroup.class, EditGroup.class })
    private Integer faultNum;

    /**
     * 故障日期
     */
    @NotNull(message = "故障日期不能为空", groups = { AddGroup.class, EditGroup.class })
    private LocalDate faultTime;

    /**
     * 部门id
     */
    @NotNull(message = "部门id不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long deptId;

    /**
     * 行政区域编号
     */
    @NotBlank(message = "行政区域编号不能为空")
    private String areaCode;

    /**
     * 品牌
     */
    @NotBlank(message = "品牌不能为空")
    private String brand;

    /**
     * 使用场景;1：住宅  2：办公、3：商场超市 4：宾馆饭店、5：:医院、 6：学校:、7：交通场所:、8：:文娱场馆、9：其他场所
     */
    @NotNull(message = "使用场景不能为空")
    private Integer useScenario;

    /**
     *
     * 故障类型标记 1.故障  2.异常故障 {@link ElevatorConstant }
     */
    private String faultTypeKey;

    /**
     * 电梯编号列表
     */
    private List<String> elevatorNumList;

    /**
     * 故障编号列表
     */
    private List<String> faultCodeList;

    /**
     * 维保ids
     */
    private List<Long> maintenanceIds;

    /**
     * 物业ids
     */
    private List<Long> tenementIds;

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

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

    /**
     * 开始日期
     */
    private LocalDate startDate;

    /**
     * 结束日期
     */
    private LocalDate endDate;

    /**
     * 发生日期起
     */
    private LocalDate happendTimeStart;
    /**
     * 发生日期止
     */
    private LocalDate happendTimeEnd;

    public EFaultStatisticsBo() {
        if (StringUtils.isBlank(faultTypeKey)) {
            this.faultTypeKey = ElevatorConstant.FAULT_TYPE_DICT_KEY;
        }
    }
}
