package com.ruoyi.device.domain.entity;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.Date;

/**
 * 调试宝设备表 tsb_device
 *
 * @author lwm
 */
public class TsbDevice extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 设备ID */
    @Excel(name = "设备序号", sort = 1, cellType = ColumnType.NUMERIC)
    private Long deviceId;

    /** 设备IMEI （唯一）*/
    @Excel(name = "设备IMEI", sort = 2)
    private String imei;

    /** 设备类型 */
    @Excel(name = "设备类型", sort = 3, readConverterExp = "9102=调试宝V3.0")
    private String deviceType;

    /** 设备SN码（在未删除记录范围内唯一） */
    @Excel(name = "设备SN码", sort = 4, cellType = ColumnType.NUMERIC)
    private Long deviceSn;

    /** 部门名称（列表展示，非表字段） */
    @Excel(name = "归属部门", sort = 5)
    private String deptName;

    /** 设备生产日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", sort = 6, width = 20, dateFormat = "yyyy-MM-dd")
    private Date deviceProduceDate;

    /** 软件版本号 */
    @Excel(name = "软件版本", sort = 7)
    private String softwareVersion;

    /** 状态（0正常 1停用） */
    @Excel(name = "状态", sort = 8, readConverterExp = "0=正常,1=停用")
    private String status;

    /** 最后在线时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "最后在线时间", sort = 9, width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
    private Date lastRunTime;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

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

    public TsbDevice()
    {

    }

    public TsbDevice(Long deviceId)
    {
        this.deviceId = deviceId;
    }

    public Long getDeviceId()
    {
        return deviceId;
    }

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

    @NotBlank(message = "IMEI不能为空")
    @Size(max = 32, message = "IMEI长度不能超过32个字符")
    public String getImei()
    {
        return imei;
    }

    public void setImei(String imei)
    {
        this.imei = imei;
    }

    @NotBlank(message = "设备型号不能为空")
    @Size(max = 32, message = "设备型号长度不能超过32个字符")
    public String getDeviceType()
    {
        return deviceType;
    }

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

    @NotNull(message = "设备SN码不能为空")
    public Long getDeviceSn()
    {
        return deviceSn;
    }

    public void setDeviceSn(Long deviceSn)
    {
        this.deviceSn = deviceSn;
    }

    public Date getDeviceProduceDate()
    {
        return deviceProduceDate;
    }

    public void setDeviceProduceDate(Date deviceProduceDate)
    {
        this.deviceProduceDate = deviceProduceDate;
    }

    @Size(max = 32, message = "软件版本号长度不能超过32个字符")
    public String getSoftwareVersion()
    {
        return softwareVersion;
    }

    public void setSoftwareVersion(String softwareVersion)
    {
        this.softwareVersion = softwareVersion;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public Date getLastRunTime()
    {
        return lastRunTime;
    }

    public void setLastRunTime(Date lastRunTime)
    {
        this.lastRunTime = lastRunTime;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    @NotNull(message = "归属部门不能为空")
    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    public String getDeptName()
    {
        return deptName;
    }

    public void setDeptName(String deptName)
    {
        this.deptName = deptName;
    }

    @Override
    public String toString()
    {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("deviceId", getDeviceId())
            .append("imei", getImei())
            .append("deviceType", getDeviceType())
            .append("deviceSn", getDeviceSn())
            .append("deviceProduceDate", getDeviceProduceDate())
            .append("softwareVersion", getSoftwareVersion())
            .append("status", getStatus())
            .append("lastRunTime", getLastRunTime())
            .append("delFlag", getDelFlag())
            .append("deptId", getDeptId())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
