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

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

import java.util.Date;
/**
 * 设备实体对象
 *
 * @author zxfei
 * @date 2023-05-11
 */
@Data
public class DeviceEntity extends DeviceVo {
    private static final long serialVersionUID = 1L;

    /**
     * 设备名称
     */
    @Excel(name = "设备名称")
    private String deviceName;
    /**
     * 设备编码,SN码等，默认为MAC地址
     */
    @Excel(name = "设备编码")
    private String deviceCode;
    /**
     * 设备的MAC地址
     */
    private String deviceMac;
    /**
     * 站点Id，来源基础服务平台
     */
    private Long siteId;
    /**
     * 站点编号，来源基础服务平台
     */
    private String siteCode;
    /**
     * 站点名称
     */
    @Excel(name = "站点名称")
    private String siteName;
    /**
     * 平台系统Id
     */
    private Long platformId;
    /**
     * 平台系统名称
     */
    @Excel(name = "平台系统名称")
    private String platformName;
    /**
     * 产品Id
     */
    private Long productId;
    /**
     * 产品名称
     */
    @Excel(name = "产品名称")
    private String productName;
    /**
     * 皮肤id
     */
    private Long skinId;
    /**
     * 皮肤名称
     */
    private String skinName;
    /**
     * 首页地址
     */
    private String homeUrl;
    /**
     * 设备生产厂商ID
     */
    private Long deviceFirmId;
    /**
     * 设备生产厂商名称
     */
    @Excel(name = "设备生产厂商名称")
    private String deviceFirmname;
    /**
     * 设备来源(0.子设备，1.网关设备，2.直连设备)
     */
    private Integer deviceSrc;
    /**
     * 数据获取方式(0.主动上报，1.被动拉取)
     */
    private Integer deviceDataSourceWay;
    /**
     * 经度
     */
    private String lon;
    /**
     * 经度
     */
    private String lati;
    /**
     * 所属楼栋
     */
    @Excel(name = "所属楼栋")
    private Integer deviceInBuilding;
    /**
     * 所属楼层
     */
    @Excel(name = "所属楼层")
    private Integer deviceInFloor;
    /**
     * 保修期至
     */
    private Date defectsLiabilityPeriod;
    /**
     * 负责人
     */
    @Excel(name = "负责人")
    private String leadingOfficial;
    /**
     * 联系电话
     */
    @Excel(name = "联系电话")
    private String leadingOfficialTelephone;
    /**
     * 是否接收异常短(0.否，1.是)
     */
    private Integer isReceiveMess;
    /**
     * 设备图片
     */
    private String devicePhotoPath;
    /**
     * 设备访问ip
     */
    private String ip;
    /**
     * 中心设备编码
     */
    private String centernum;
    /**
     * 端口
     */
    private String port;
    /**
     * 设备topic信息
     */
    private String deviceTopic;
    /**
     * 设备状态 (0.未激活，1.离线,2.在线)
     */
    private Integer deviceStatus;
    /**
     * 启用状态 (0.停止，1.启用)
     */
    private Integer enabled;
    /**
     * 设备授权码
     */
    private String deviceAuthCode;
    /**
     * 备注
     */
    private String deviceRemark;
    /**
     * 最近上线时间
     */
    private Date onlineTime;
    /**
     * 最近离线时间
     */
    private Date offlineTime;
    /**
     * 是否删除(0.否，1.是)
     */
    private Integer deleted;
    /**
     * 设备来源(0.旧设备，1.新设备)
     */
    @Excel(name = "设备来源", readConverterExp = "0=旧设备,1=新设备")
    private Integer source;
    /**
     * 设备SN码
     */
    private String deviceSN;
    /**
     * 设备版本
     */
    private String deviceVersion;
    /**
     * 产品编码
     */
    @Excel(name = "产品类型",cacheDict = "productDict" ,type = Excel.Type.IMPORT)
    private String productCode;
    /**
     * 大厅Id
     */
    private Long hallId;
    /**
     * 大厅名称
     */
    @Excel(name = "大厅名称")
    private String hallName;
    /**
     * 是否显示短信(0.否，1.是)
     */
    private Integer showSms;
    /**
     * 是否显示打印机(0.否，1.是)
     */
    private Integer showPrint;
    /**
     * 是否显示小程序二维码(0.否，1.是)
     */
    private Integer showWechatQrCode;
    @Override
    public int hashCode() {
        return this.getId().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (obj instanceof DeviceEntity) {
            DeviceEntity tmp = (DeviceEntity) obj;
            if (this.getId() == tmp.getId()) {
                return true;
            }
        }
        return false;
    }

    public void initAttrValue(){

        this.deviceName = "";

        this.deviceCode = "";

        this.deviceMac = "";

        this.siteId = null;

        this.siteCode = "";

        this.siteName = "";

        this.platformId = null;

        this.platformName = "";

        this.productId = null;

        this.productName = "";

        this.skinId = null;

        this.skinName = "";

        this.homeUrl = "";

        this.deviceFirmId = null;

        this.deviceFirmname = "";

        this.deviceSrc = 2;

        this.deviceDataSourceWay = 0;

        this.lon = "";

        this.lati = "";

        this.deviceInBuilding = null;

        this.deviceInFloor = null;

        this.defectsLiabilityPeriod = null;

        this.leadingOfficial = "";

        this.leadingOfficialTelephone = "";

        this.isReceiveMess = 0;

        this.devicePhotoPath = "";

        this.ip = "";

        this.centernum = "";

        this.port = "";

        this.deviceTopic = "";

        this.deviceStatus = 0;

        this.enabled = 0;

        this.deviceAuthCode = "";

        this.deviceRemark = "";

        this.onlineTime = null;

        this.offlineTime = null;

        this.deleted = 0;

        this.source = 1;

        this.deviceSN = "";

        this.deviceVersion = "";

        this.productCode = "";

        this.hallId = null;

        this.hallName = "";

        this.showSms = 1;

        this.showPrint = 1;

        this.showWechatQrCode = 1;
    }
}