package com.xzzn.ems.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xzzn.common.annotation.Excel;
import com.xzzn.common.core.domain.BaseEntity;

import java.util.Date;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * Modbus设备配置对象 ems_devices_setting
 *
 * @author xzzn
 * @date 2025-07-12
 */
public class EmsDevicesSetting extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 设备ID，主键自增长 */
    private Long id;

    /** 设备名称，用于标识设备 */
    @Excel(name = "设备名称，用于标识设备")
    private String deviceName;

    /** 设备类型: TCP （网络设备），RTU（串口设备) */
    @Excel(name = "设备类型: TCP ", readConverterExp = "网=络设备")
    private String deviceType;

    /** 从站地址，默认为1 */
    @Excel(name = "从站地址，默认为1")
    private Long slaveId;

    /** 通信超时时间(毫秒)，默认1000ms */
    @Excel(name = "通信超时时间(毫秒)，默认1000ms")
    private Long timeoutMs;

    /** 通信失败重试次数，默认3次 */
    @Excel(name = "通信失败重试次数，默认3次")
    private Long retries;

    /** TCP设备的IP地址，仅TCP类型需要 */
    @Excel(name = "TCP设备的IP地址，仅TCP类型需要")
    private String ipAddress;

    /** TCP端口号，通常502，仅TCP类型需要 */
    @Excel(name = "TCP端口号，通常502，仅TCP类型需要")
    private Long ipPort;

    /** 串口路径(如COM3或/dev/ttyUSB0)，仅RTU类型需要 */
    @Excel(name = "串口路径(如COM3或/dev/ttyUSB0)，仅RTU类型需要")
    private String serialPort;

    /** 波特率(如9600,19200)，仅RTU类型需要 */
    @Excel(name = "波特率(如9600,19200)，仅RTU类型需要")
    private Long baudRate;

    /** 数据位(通常8)，仅RTU类型需要 */
    @Excel(name = "数据位(通常8)，仅RTU类型需要")
    private Long dataBits;

    /** 停止位(1或2)，仅RTU类型需要 */
    @Excel(name = "停止位(1或2)，仅RTU类型需要")
    private Long stopBits;

    /** 校验位(NONE无校验/EVEN偶校验/ODD奇校验)，仅RTU类型需要 */
    @Excel(name = "校验位(NONE无校验/EVEN偶校验/ODD奇校验)，仅RTU类型需要")
    private String parity;

    /** 设备描述信息 */
    @Excel(name = "设备描述信息")
    private String description;

    /** 记录创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "记录创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createdAt;

    /** 记录最后更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "记录最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updatedAt;

    /** 站点id */
    @Excel(name = "站点id")
    private String siteId;

    /** 通信状态:0-正常 1-通信中断 2-异常 */
    @Excel(name = "通信状态:0-正常 1-通信中断 2-异常")
    private String communicationStatus;

    /** 设备唯一标识符 */
    @Excel(name = "设备唯一标识符")
    private String deviceId;

    /** 上级设备id */
    @Excel(name = "上级设备id")
    private String parentId;

    /** 设备类别，例如“STACK/CLUSTER/PCS等” */
    @Excel(name = "设备类别，例如“STACK/CLUSTER/PCS等”")
    private String deviceCategory;

    /** 设备运行状态：0-离线、1-在线 */
    @Excel(name = "设备运行状态：0-离线、1-在线")
    private String deviceStatus;

    /** 设备运行状态：0-离线、1-在线 */
    @Excel(name = "工作状态：0-运行 1-停机 2-故障")
    private String workStatus;

    /** 设备图像地址 */
    @Excel(name = "设备图像地址")
    private String pictureUrl;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }

    public void setDeviceName(String deviceName)
    {
        this.deviceName = deviceName;
    }

    public String getDeviceName()
    {
        return deviceName;
    }

    public void setDeviceType(String deviceType)
    {
        this.deviceType = deviceType;
    }

    public String getDeviceType()
    {
        return deviceType;
    }

    public void setSlaveId(Long slaveId)
    {
        this.slaveId = slaveId;
    }

    public Long getSlaveId()
    {
        return slaveId;
    }

    public void setTimeoutMs(Long timeoutMs)
    {
        this.timeoutMs = timeoutMs;
    }

    public Long getTimeoutMs()
    {
        return timeoutMs;
    }

    public void setRetries(Long retries)
    {
        this.retries = retries;
    }

    public Long getRetries()
    {
        return retries;
    }

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

    public String getIpAddress()
    {
        return ipAddress;
    }

    public void setIpPort(Long ipPort)
    {
        this.ipPort = ipPort;
    }

    public Long getIpPort()
    {
        return ipPort;
    }

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

    public String getSerialPort()
    {
        return serialPort;
    }

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

    public Long getBaudRate()
    {
        return baudRate;
    }

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

    public Long getDataBits()
    {
        return dataBits;
    }

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

    public Long getStopBits()
    {
        return stopBits;
    }

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

    public String getParity()
    {
        return parity;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    public String getDescription()
    {
        return description;
    }

    public void setCreatedAt(Date createdAt)
    {
        this.createdAt = createdAt;
    }

    public Date getCreatedAt()
    {
        return createdAt;
    }

    public void setUpdatedAt(Date updatedAt)
    {
        this.updatedAt = updatedAt;
    }

    public Date getUpdatedAt()
    {
        return updatedAt;
    }

    public void setSiteId(String siteId)
    {
        this.siteId = siteId;
    }

    public String getSiteId()
    {
        return siteId;
    }

    public void setCommunicationStatus(String communicationStatus)
    {
        this.communicationStatus = communicationStatus;
    }

    public String getCommunicationStatus()
    {
        return communicationStatus;
    }

    public void setDeviceId(String deviceId)
    {
        this.deviceId = deviceId;
    }

    public String getDeviceId()
    {
        return deviceId;
    }

    public void setParentId(String parentId)
    {
        this.parentId = parentId;
    }

    public String getParentId()
    {
        return parentId;
    }

    public void setDeviceCategory(String deviceCategory)
    {
        this.deviceCategory = deviceCategory;
    }

    public String getDeviceCategory()
    {
        return deviceCategory;
    }

    public String getDeviceStatus() {
        return deviceStatus;
    }

    public void setDeviceStatus(String deviceStatus) {
        this.deviceStatus = deviceStatus;
    }

    public String getWorkStatus() {
        return workStatus;
    }

    public void setWorkStatus(String workStatus) {
        this.workStatus = workStatus;
    }

    public void setPictureUrl(String pictureUrl)
    {
        this.pictureUrl = pictureUrl;
    }

    public String getPictureUrl()
    {
        return pictureUrl;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("deviceName", getDeviceName())
                .append("deviceType", getDeviceType())
                .append("slaveId", getSlaveId())
                .append("timeoutMs", getTimeoutMs())
                .append("retries", getRetries())
                .append("ipAddress", getIpAddress())
                .append("ipPort", getIpPort())
                .append("serialPort", getSerialPort())
                .append("baudRate", getBaudRate())
                .append("dataBits", getDataBits())
                .append("stopBits", getStopBits())
                .append("parity", getParity())
                .append("description", getDescription())
                .append("createdAt", getCreatedAt())
                .append("updatedAt", getUpdatedAt())
                .append("siteId", getSiteId())
                .append("communicationStatus", getCommunicationStatus())
                .append("deviceId", getDeviceId())
                .append("parentId", getParentId())
                .append("deviceCategory", getDeviceCategory())
                .append("deviceStatus", getDeviceStatus())
                .append("pictureUrl", getPictureUrl())
                .toString();
    }
}
