package org.dromara.ems.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 采集设备信息对象 ems_base_collect_device_info
 *
 * @author Yinq
 * @date 2024-05-20
 */
@ExcelIgnoreUnannotated
public class EmsBaseCollectDeviceInfo extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 自增标识
     */
    private Long objId;

    /**
     * 采集设备编号
     */
    @ExcelProperty(value = "采集设备编号")
    private String collectDeviceId;

    /**
     * 采集设备名称
     */
    @ExcelProperty(value = "采集设备名称")
    private String collectDeviceName;

    /**
     * 能源类型
     */
    @ExcelProperty(value = "能源类型")
    private Long energyTypeId;

    /**
     * 能源类型名称
     */
    @ExcelProperty(value = "能源类型名称")
    private String energyTypeName;

    /**
     * 型号
     */
    @ExcelProperty(value = "型号")
    private String model;

    /**
     * 生产厂家
     */
    @ExcelProperty(value = "生产厂家")
    private String manufacturer;

    /**
     * 通讯地址
     */
    @ExcelProperty(value = "通讯地址")
    private String ipAddress;

    /**
     * 生产日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "生产日期")
    private Date produceDate;

    /**
     * 安装地址
     */
    @ExcelProperty(value = "安装地址")
    private String settingAddress;

    /**
     * 启用标识（0启用 1停用）
     */
    @ExcelProperty(value = "启用标识")
    private String isFlag;

    /**
     * 以下协议接入字段属于技术字段，主要用于兼容 OPC/Modbus 等接入方式，不直接改变采集设备主业务标识。
     */
    private String tenantId;

    private String protocolType;

    private String protocolVersion;

    private Integer port;

    private Integer slaveNo;

    private String serialPort;

    private Integer baudRate;

    private Integer dataBits;

    private Integer stopBits;

    private String parity;

    private String opcEndpointUrl;

    private String opcSecurityPolicy;

    private String opcSecurityMode;

    private String username;

    private String password;

    /**
     * 在线状态字段用于后端判断设备可用性，前端如需展示应优先展示状态文案而不是底层协议参数。
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private Date heartbeatTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private Date lastOnlineTime;

    private Integer offlineTimeoutSec;

    private String onlineStatus;

    public String getEnergyTypeName() {
        return energyTypeName;
    }

    public void setEnergyTypeName(String energyTypeName) {
        this.energyTypeName = energyTypeName;
    }

    public void setObjId(Long objId) {
        this.objId = objId;
    }

    public Long getObjId() {
        return objId;
    }

    public void setCollectDeviceId(String collectDeviceId) {
        this.collectDeviceId = collectDeviceId;
    }

    public String getCollectDeviceId() {
        return collectDeviceId;
    }

    public void setCollectDeviceName(String collectDeviceName) {
        this.collectDeviceName = collectDeviceName;
    }

    public String getCollectDeviceName() {
        return collectDeviceName;
    }

    public void setEnergyTypeId(Long energyTypeId) {
        this.energyTypeId = energyTypeId;
    }

    public Long getEnergyTypeId() {
        return energyTypeId;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getModel() {
        return model;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public void setProduceDate(Date produceDate) {
        this.produceDate = produceDate;
    }

    public Date getProduceDate() {
        return produceDate;
    }

    public void setSettingAddress(String settingAddress) {
        this.settingAddress = settingAddress;
    }

    public String getSettingAddress() {
        return settingAddress;
    }

    public void setIsFlag(String isFlag) {
        this.isFlag = isFlag;
    }

    public String getIsFlag() {
        return isFlag;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getProtocolType() {
        return protocolType;
    }

    public void setProtocolType(String protocolType) {
        this.protocolType = protocolType;
    }

    public String getProtocolVersion() {
        return protocolVersion;
    }

    public void setProtocolVersion(String protocolVersion) {
        this.protocolVersion = protocolVersion;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public Integer getSlaveNo() {
        return slaveNo;
    }

    public void setSlaveNo(Integer slaveNo) {
        this.slaveNo = slaveNo;
    }

    public String getSerialPort() {
        return serialPort;
    }

    public void setSerialPort(String serialPort) {
        this.serialPort = serialPort;
    }

    public Integer getBaudRate() {
        return baudRate;
    }

    public void setBaudRate(Integer baudRate) {
        this.baudRate = baudRate;
    }

    public Integer getDataBits() {
        return dataBits;
    }

    public void setDataBits(Integer dataBits) {
        this.dataBits = dataBits;
    }

    public Integer getStopBits() {
        return stopBits;
    }

    public void setStopBits(Integer stopBits) {
        this.stopBits = stopBits;
    }

    public String getParity() {
        return parity;
    }

    public void setParity(String parity) {
        this.parity = parity;
    }

    public String getOpcEndpointUrl() {
        return opcEndpointUrl;
    }

    public void setOpcEndpointUrl(String opcEndpointUrl) {
        this.opcEndpointUrl = opcEndpointUrl;
    }

    public String getOpcSecurityPolicy() {
        return opcSecurityPolicy;
    }

    public void setOpcSecurityPolicy(String opcSecurityPolicy) {
        this.opcSecurityPolicy = opcSecurityPolicy;
    }

    public String getOpcSecurityMode() {
        return opcSecurityMode;
    }

    public void setOpcSecurityMode(String opcSecurityMode) {
        this.opcSecurityMode = opcSecurityMode;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getHeartbeatTime() {
        return heartbeatTime;
    }

    public void setHeartbeatTime(Date heartbeatTime) {
        this.heartbeatTime = heartbeatTime;
    }

    public Date getLastOnlineTime() {
        return lastOnlineTime;
    }

    public void setLastOnlineTime(Date lastOnlineTime) {
        this.lastOnlineTime = lastOnlineTime;
    }

    public Integer getOfflineTimeoutSec() {
        return offlineTimeoutSec;
    }

    public void setOfflineTimeoutSec(Integer offlineTimeoutSec) {
        this.offlineTimeoutSec = offlineTimeoutSec;
    }

    public String getOnlineStatus() {
        return onlineStatus;
    }

    public void setOnlineStatus(String onlineStatus) {
        this.onlineStatus = onlineStatus;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("objId", getObjId())
            .append("collectDeviceId", getCollectDeviceId())
            .append("collectDeviceName", getCollectDeviceName())
            .append("energyTypeId", getEnergyTypeId())
            .append("energyTypeName", getEnergyTypeName())
            .append("model", getModel())
            .append("manufacturer", getManufacturer())
            .append("ipAddress", getIpAddress())
            .append("produceDate", getProduceDate())
            .append("settingAddress", getSettingAddress())
            .append("isFlag", getIsFlag())
            .append("tenantId", getTenantId())
            .append("protocolType", getProtocolType())
            .append("protocolVersion", getProtocolVersion())
            .append("port", getPort())
            .append("slaveNo", getSlaveNo())
            .append("serialPort", getSerialPort())
            .append("baudRate", getBaudRate())
            .append("dataBits", getDataBits())
            .append("stopBits", getStopBits())
            .append("parity", getParity())
            .append("opcEndpointUrl", getOpcEndpointUrl())
            .append("opcSecurityPolicy", getOpcSecurityPolicy())
            .append("opcSecurityMode", getOpcSecurityMode())
            .append("username", getUsername())
            .append("password", getPassword())
            .append("heartbeatTime", getHeartbeatTime())
            .append("lastOnlineTime", getLastOnlineTime())
            .append("offlineTimeoutSec", getOfflineTimeoutSec())
            .append("onlineStatus", getOnlineStatus())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
