package com.mortals.xhx.module.device.model;

import com.mortals.framework.annotation.Excel;
import com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo;
import lombok.Data;

import java.util.Date;
/**
 * 设备告警日志实体对象
 *
 * @author zxfei
 * @date 2023-12-08
 */
@Data
public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
    private static final long serialVersionUID = 1L;

    /**
     * 告警时间
     */
    @Excel(name = "告警时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date alarmTime;
    /**
     * 告警设备Id
     */
    private Long alarmDevice;
    /**
     * 告警类型(0.离线)
     */
    private Integer alarmType;
    /**
     * 告警级别(0.危险，1.次要，2.一般)
     */
    @Excel(name = "告警级别", readConverterExp = "0=危险,1=次要,2=一般")
    private Integer alarmLevel;
    /**
     * 接收人员[设备管理的责任人]
     */
    @Excel(name = "接收人员[设备管理的责任人]")
    private String alarmReceivePersonnel;
    /**
     * 接收人员电话
     */
    @Excel(name = "接收人员电话")
    private String receivePersonnelTelephone;
    /**
     * 告警状态,来自工单系统(0.未清除，1.清除未确认，2.清除已确认)
     */
    private Integer alarmStatus;
    /**
     * 告警详细内容
     */
    @Excel(name = "告警详细内容")
    private String alarmContent;
    /**
     * 站点Id，来源基础服务平台
     */
    private Long siteId;
    /**
     * 设备编码
     */
    @Excel(name = "设备编码")
    private String deviceCode;
    /**
     * 设备名称
     */
    @Excel(name = "设备名称")
    private String deviceName;
    /**
     * 是否推送
     */
    private Integer push;
    /**
     * 产品Id
     */
    private Long productId;
    /**
     * 产品编码
     */
    private String productCode;
    /**
     * 产品名称
     */
    @Excel(name = "产品名称")
    private String productName;
    @Override
    public int hashCode() {
        return this.getId().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (obj instanceof DeviceAlarmInfoEntity) {
            DeviceAlarmInfoEntity tmp = (DeviceAlarmInfoEntity) obj;
            if (this.getId() == tmp.getId()) {
                return true;
            }
        }
        return false;
    }

    public void initAttrValue(){
        this.alarmTime = new Date();
        this.alarmDevice = null;
        this.alarmType = 0;
        this.alarmLevel = 0;
        this.alarmReceivePersonnel = "";
        this.receivePersonnelTelephone = "";
        this.alarmStatus = 0;
        this.alarmContent = "";
        this.siteId = null;
        this.deviceCode = "";
        this.deviceName = "";
        this.push = 0;
        this.productId = null;
        this.productCode = "";
        this.productName = "";
    }
}