package org.dromara.elevator.domain.bo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.elevator.constant.ElevatorConstant;
import org.dromara.elevator.domain.EFaultMessage;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 故障消息;业务对象 e_fault_message
 *
 * @author zy
 * @date 2024-07-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = EFaultMessage.class, reverseConvertGenerate = false)
public class EFaultMessageBo extends BaseEntity {

    /**
     * 主键id
     */
    private Long id;

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

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

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

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

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

    /**
     * 电梯注册代码
     */
    private String registerCode;

    /**
     * 发生时间
     */
    private Date happenTime;

    /**
     * 发生时间止
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date happenTimeEnd;

    /**
     * 发生时间起
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date happenTimeStart;

    /**
     * 恢复时间
     */
    private Date recoverTime;

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

    /**
     * 楼层
     */
    private String floor;

    /**
     * 故障图片
     */
    private String picture;

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

    /**
     * 确认人
     */
    private String affirmPeople;

    /**
     * 故障原因
     */
    private String cause;

    /**
     * 故障原因编码
     */
    private String causeCode;

    /**
     * 原因分析编码
     */
    private String causeAnalyseCode;

    /**
     * 原因分析
     */
    private String causeAnalyse;

    /**
     * 故障说明
     */
    private String explain;

    /**
     * 视频地址
     */
    private String videoAddress;

    /**
     * 部门ID
     */
    private Long deptId;

    /**
     * 经度
     */
    private BigDecimal lng;

    /**
     * 纬度
     */
    private BigDecimal lat;

    /**
     * 故障推送类型 1:故障发生主 2、故障恢复 、3故障发生恢复
     */
    private Integer faultPushType;

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

    /**
     * 小程序消息查询
     */
    private Boolean miniMsgFlag;

    /**
     * 关注的的电梯列表
     */
    private List<String> followElevatorList;

    public EFaultMessageBo() {
        if (Objects.isNull(miniMsgFlag)) {
            this.miniMsgFlag = Boolean.FALSE;
        }
    }
}
