package com.zd.laboratory.domain;

import com.zd.common.core.annotation.Excel;
import com.zd.common.core.utils.DateUtils;
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;

/**
 * 继电器和传感器网关对象 lab_relay
 *
 * @author zd
 * @date 2021-10-16
 */
@ApiModel("继电器和传感器网关")
public class LabRelay extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @ApiModelProperty(value = "${comment}")
    private Long id;
    /** 继电器编码 */
    @Excel(name = "继电器编码")
    @ApiModelProperty(value = "继电器编码")
    private String code;
    /** 类型（1 继电器，2 传感器网关） */
    @ApiModelProperty(value = "类型")
    private Integer type;
    /** 线路数量 */
    @Excel(name = "线路数量")
    @ApiModelProperty(value = "线路数量")
    private Integer routeNum;
    /** bit位反转值 */
    @Excel(name = "bit位反转值")
    @Length(message = "bit位反转值长度不能超过20")
    @ApiModelProperty(value = "bit位反转值")
    private String reverseBit;

    /**
     * 传感器解析顺序配置ID
     */
    private Long configId;


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

    public Long getId()
    {
        return id;
    }
    public void setCode(String code)
    {
        this.code = code;
    }

    public String getCode()
    {
        return code;
    }
    public void setType(Integer type)
    {
        this.type = type;
    }

    public Integer getType()
    {
        return type;
    }
    public void setRouteNum(Integer routeNum)
    {
        this.routeNum = routeNum;
    }

    public Integer getRouteNum()
    {
        return routeNum;
    }
    public void setReverseBit(String reverseBit)
    {
        this.reverseBit = reverseBit;
    }

    public String getReverseBit()
    {
        return reverseBit;
    }

    public LabRelay() {
    }

    public LabRelay(String code, Integer type, Integer routeNum) {
        this.code = code;
        this.type = type;
        this.routeNum = routeNum;
        this.setCreateTime(DateUtils.getNowDate());
    }

    public LabRelay(String code, Integer type, Integer routeNum, String reverseBit) {
        this.code = code;
        this.type = type;
        this.routeNum = routeNum;
        this.reverseBit = reverseBit;
        this.setCreateTime(DateUtils.getNowDate());
    }

    public Long getConfigId() {
        return configId;
    }

    public void setConfigId(Long configId) {
        this.configId = configId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("code", getCode())
            .append("type", getType())
            .append("routeNum", getRouteNum())
            .append("reverseBit", getReverseBit())
            .append("createTime", getCreateTime())
            .toString();
    }
}
