package com.zd.laboratory.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.zd.common.core.annotation.Excel;
import com.zd.common.core.enums.HardwareOperate;
import com.zd.common.core.enums.HardwareTypeEnum;
import com.zd.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import java.util.Date;

/**
 * 硬件对象 lab_hardware
 *
 * @author zd
 */
@ApiModel("硬件表")
public class LabHardware extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @ApiModelProperty(value = "${comment}")
    private Long id;

    /**
     * 设备名称
     */
    @ApiModelProperty("设备名称")
    @Excel(name = "设备名称")
    private String name;

    /**
     * 设备厂家
     */
    @ApiModelProperty("设备厂家")
    @Excel(name = "设备厂家")
    private String factory;

    /**
     * 设备类型
     */
    @ApiModelProperty("设备类型")
    @Excel(name = "设备类型")
    private HardwareTypeEnum type;

    /**
     * 一体机类型，管控一体机0  学习考试一体机1
     */
    @ApiModelProperty("一体机类型")
    @Excel(name = "一体机类型")
    private Integer pcType;

    /**
     * mac地址
     */
    @ApiModelProperty("mac地址")
    @Excel(name = "mac地址")
    private String macAdd;

    /**
     * 所属实验室id
     */
    @ApiModelProperty("所属实验室id")
    @Excel(name = "所属实验室id")
    private Long subjectId;

    /**
     * 部门id
     */
    @ApiModelProperty("部门id")
    @Excel(name = "部门id")
    private Long deptId;

    /**
     * 部门名称
     */
    @ApiModelProperty("部门名称")
    @Excel(name = "部门名称")
    private String deptName;

    /**
     * 设备状态
     */
    @ApiModelProperty("设备状态")
    @Excel(name = "设备状态")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private HardwareOperate operate;

    /**
     * 创建人（用于数据权限）
     */
    @ApiModelProperty("创建人（用于数据权限）")
    @Excel(name = "创建人", readConverterExp = "用=于数据权限")
    private Long userId;

    @ApiModelProperty("设备编码")
    private String hardwareNum;

    /**
     * 配置名称
     */
    private String configName;

    /**
     * 配置状态
     */
    private String configStatus;

    /**
     * 老继电器，新继电器
     */
    private int hardwareType;

    /** ip地址 */
    @Length(message = "ip地址长度不能超过100")
    @ApiModelProperty(value = "ip地址")
    private String ipAddress;
    /** 设备端口号 */
    @ApiModelProperty(value = "设备端口号")
    private Integer port;
    /** 设备输出频率 33最大 */
    @ApiModelProperty(value = "设备输出频率 33最大")
    private String uniformPower;
    /** 设备推送频率，0最大，2最小 */
    @ApiModelProperty(value = "设备推送频率，0最大，2最小")
    private Byte sessionIndex;
    /** 支持1通道、4通道、8通道、16通道 */
    @ApiModelProperty(value = "支持1通道、4通道、8通道、16通道")
    private Integer channels;

    /** 柜锁id */
    @ApiModelProperty(value = "柜锁id")
    private Integer lockId;



    public String getHardwareNum() {
        return hardwareNum;
    }

    public void setHardwareNum(String hardwareNum) {
        this.hardwareNum = hardwareNum;
    }

    /**
     * 功能状态： 不同设备的功能状态都是不一样的
     */
    private String functionStatus;

    /**
     * 横轴坐标
     */
    private String horizontalAxis;

    /**
     * 竖轴坐标
     */
    private String verticalAxis;

    /**
     * 关联继电器编码
     */
    private String relayCode;

    /**
     * 继电器位数
     */
    private Integer bit;

    /**
     * 按照分钟计算，默认给10分钟，（目前只有柜锁类型使用）
     */
    private Integer operateTime;

    /**
     * 按照分钟计算，默认给10分钟，（目前只有柜锁类型使用）
     */
    @ApiModelProperty(value = "关联的机柜id(一个锁子只能绑定一个机柜，一个机柜可以绑定多把锁子)")
    private Long joinCabinet;

    @ApiModelProperty(value = "关联机柜时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date joinCabinetTime;

    @ApiModelProperty(value = "是否关联 1是0否")
    private Integer joinCabinetLock;

    @ApiModelProperty(value = "设备启用停用（1是启用，0是停用）")
    private Integer deviceStatus;
    @ApiModelProperty(value = "供应厂商")
    private Integer manufacturerType;

    public Integer getManufacturerType() {
        return manufacturerType;
    }

    public void setManufacturerType(Integer manufacturerType) {
        this.manufacturerType = manufacturerType;
    }

    public String getFunctionStatus() {
        return functionStatus;
    }

    public void setFunctionStatus(String functionStatus) {
        this.functionStatus = functionStatus;
    }

    private LabSubjectHardwarePosition hardwarePosition;

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

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setFactory(String factory) {
        this.factory = factory;
    }

    public String getFactory() {
        return factory;
    }

    public void setType(HardwareTypeEnum type) {
        this.type = type;
    }

    public HardwareTypeEnum getType() {
        return type;
    }

    public void setMacAdd(String macAdd) {
        this.macAdd = macAdd;
    }

    public String getMacAdd() {
        return macAdd;
    }

    public void setSubjectId(Long subjectId) {
        this.subjectId = subjectId;
    }

    public Long getSubjectId() {
        return subjectId;
    }

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

    @Override
    public Long getDeptId() {
        return deptId;
    }

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

    @Override
    public String getDeptName() {
        return deptName;
    }

    public void setOperate(HardwareOperate operate) {
        this.operate = operate;
    }

    public HardwareOperate getOperate() {
        return operate;
    }

    @Override
    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Override
    public Long getUserId() {
        return userId;
    }

    public LabSubjectHardwarePosition getHardwarePosition() {
        return hardwarePosition;
    }

    public void setHardwarePosition(LabSubjectHardwarePosition hardwarePosition) {
        this.hardwarePosition = hardwarePosition;
    }

    public String getHorizontalAxis() {
        return horizontalAxis;
    }

    public void setHorizontalAxis(String horizontalAxis) {
        this.horizontalAxis = horizontalAxis;
    }

    public String getVerticalAxis() {
        return verticalAxis;
    }

    public void setVerticalAxis(String verticalAxis) {
        this.verticalAxis = verticalAxis;
    }

    public String getRelayCode() {
        return relayCode;
    }

    public void setRelayCode(String relayCode) {
        this.relayCode = relayCode;
    }

    public Integer getBit() {
        if(this.bit != null && this.bit == -1){
            this.bit = null;
        }
        return bit;
    }

    public void setBit(Integer bit) {
        this.bit = bit;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("factory", getFactory())
                .append("type", getType())
                .append("pcType", getPcType())
                .append("macAdd", getMacAdd())
                .append("subjectId", getSubjectId())
                .append("deptId", getDeptId())
                .append("deptName", getDeptName())
                .append("operate", getOperate())
                .append("createTime", getCreateTime())
                .append("userId", getUserId())
                .append("createBy", getCreateBy())
                .append("updateTime", getUpdateTime())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .toString();
    }

    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    public String getConfigStatus() {
        return configStatus;
    }

    public void setConfigStatus(String configStatus) {
        this.configStatus = configStatus;
    }

    public int getHardwareType() {
        return hardwareType;
    }

    public void setHardwareType(int hardwareType) {
        this.hardwareType = hardwareType;
    }

    public Integer getOperateTime() {
        return operateTime;
    }

    public void setOperateTime(Integer operateTime) {
        this.operateTime = operateTime;
    }

    public Long getJoinCabinet() {
        return joinCabinet;
    }

    public void setJoinCabinet(Long joinCabinet) {
        this.joinCabinet = joinCabinet;
    }

    public Integer getPcType() {        return pcType;    }

    public void setPcType(Integer pcType) {        this.pcType = pcType;    }

    public String getIpAddress() {
        return ipAddress;
    }

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

    public Integer getPort() {
        return port;
    }

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

    public String getUniformPower() {
        return uniformPower;
    }

    public void setUniformPower(String uniformPower) {
        this.uniformPower = uniformPower;
    }

    public Byte getSessionIndex() {
        return sessionIndex;
    }

    public void setSessionIndex(Byte sessionIndex) {
        this.sessionIndex = sessionIndex;
    }

    public Integer getChannels() {
        return channels;
    }

    public void setChannels(Integer channels) {
        this.channels = channels;
    }

    public Integer getJoinCabinetLock() {
        return joinCabinetLock;
    }

    public void setJoinCabinetLock(Integer joinCabinetLock) {
        this.joinCabinetLock = joinCabinetLock;
    }

    public Date getJoinCabinetTime() {
        return joinCabinetTime;
    }

    public void setJoinCabinetTime(Date joinCabinetTime) {
        this.joinCabinetTime = joinCabinetTime;
    }

    public Integer getLockId() {
        return lockId;
    }

    public void setLockId(Integer lockId) {
        this.lockId = lockId;
    }

    public Integer getDeviceStatus() {
        return deviceStatus;
    }

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