package com.casic.missiles.modular.system.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * <p>
 * NB设备表
 * </p>
 *
 * @author tanyue
 * @since 2019-05-23
 */
@TableName("bus_nb_device")
@Data
public class BusNbDevice extends Model<BusNbDevice> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "ID", type = IdType.AUTO)
    private Long id;

    /**
     * NB设备编号
     */
    @TableField("NB_DEVICE_ID")
    private String nbDeviceId;

    /**
     * 厂家设备编号
     */
    @Pattern(regexp = "[A-Za-z0-9]{7,20}",message = "设备编号必须为7-20位字母或数字组合")
    @TableField("DEVCODE")
    private String devcode;

    /**
     * 模块IMEI号
     */
    @TableField("VERIFY_CODE")
    private String verifyCode;

    /**
     * NB设备名称
     */
    @TableField("NODEID")
    private String nodeid;

    /**
     * 超时时间
     */
    @TableField("TIMEOUT")
    private Integer timeout;

    /**
     * 设备名称
     */
    @NotEmpty(message = "设备名称不能为空")
    @TableField("NAME")
    private String name;

    /**
     * 厂商ID
     */
    @TableField("MANUFACTURER_ID")
    private String manufacturerId;

    /**
     * 厂商名称
     */
    @TableField("MANUFACTURER_NAME")
    private String manufacturerName;

    /**
     * 设备类型
     */
    @TableField("DEVICE_TYPE")
    private String deviceType;

    /**
     * 设备型号
     */
    @TableField("MODEL")
    private String model;

    /**
     * 设备协议类型
     */
    @TableField("PROTOCAL_TYPE")
    private String protocalType;

    /**
     * 设备安全模式
     */
    @TableField("IS_SECURE")
    private String isSecure;
    @TableField(exist = false)
    private String captcha;//验证码
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "NBDevice{" +
                "id=" + id +
                ", devcode=" + devcode +
                ", name=" + name +
                ", verifyCode=" + verifyCode +
                ", deviceType=" + deviceType +
                ", manufacturerName=" + manufacturerName +
                ", model=" + model +
                "}";
    }
}
