package com.bonus.core.device.manage.model;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bonus.framework.config.deserializer.DateTimeDeserializer;
import com.bonus.framework.config.serializer.DateTimeSerializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;

@TableName("device_info")
public class DeviceInfo {
   @TableId
   @ApiModelProperty("主键id")
   private Long deviceId;
   @TableField(
      updateStrategy = FieldStrategy.IGNORED
   )
   @ApiModelProperty("生效范围id")
   private Long effId;
   @ApiModelProperty("设备sn码")
   private String deviceSn;
   @ApiModelProperty("设备名称")
   private String deviceName;
   @ApiModelProperty("设备编号")
   private String deviceNum;
   @ApiModelProperty("设备型号")
   private String deviceModel;
   @ApiModelProperty("设备类型")
   private Integer deviceType;
   @ApiModelProperty("设备密码")
   private String devicePwd;
   @ApiModelProperty("设备安装地址")
   private String deviceAddr;
   @ApiModelProperty("设备key")
   private String deviceKey;
   @ApiModelProperty("关联设备id")
   private Long deviceParentId;
   @ApiModelProperty("关联父设备类型")
   private String deviceParentType;
   @ApiModelProperty("服务器ip/域名")
   private String deviceServiceIp;
   @ApiModelProperty("服务器端口")
   private String deviceServicePort;
   @ApiModelProperty("版本号（MQTT上报）")
   private Integer versionCode;
   @ApiModelProperty("版本名称（MQTT上报）")
   private String versionName;
   @ApiModelProperty("通信协议")
   private Integer deviceAgreement;
   @ApiModelProperty("设备在线状态 1在线 2离线（MQTT上报）")
   private Integer onlineState;
   @ApiModelProperty("通讯模式")
   private Integer commMode;
   @ApiModelProperty("设备ip")
   private String deviceIp;
   @ApiModelProperty("子网掩码")
   private String deviceMask;
   @ApiModelProperty("设备mac")
   private String deviceMac;
   @ApiModelProperty("网关")
   private String deviceGateway;
   @ApiModelProperty("首选dns")
   private String firstDns;
   @ApiModelProperty("备选dns")
   private String nextDns;
   @ApiModelProperty("设备是否启用 1-是 2-否")
   private Integer ifEnable;
   @ApiModelProperty("图片地址（当mch_type为40 时，该字段表示背景图）")
   private String imgUrl;
   @ApiModelProperty("设备数据传输状态，1-传输完毕， 0-传输中")
   private Integer dataStatus;
   @ApiModelProperty("消费模式(扣费模式)")
   private Integer consumMode;
   @ApiModelProperty("是否限额")
   private Integer ifQuotaLimit;
   @ApiModelProperty("是否打折")
   private Integer ifDiscount;
   @ApiModelProperty("是否限次")
   private Integer ifTimeLimit;
   @ApiModelProperty("是否启用叫号")
   private Integer ifUseCallNum;
   @ApiModelProperty("账户余额不足多少提醒")
   private Integer amountNotify;
   @ApiModelProperty("餐盘绑定有效时间")
   private Integer bindingValidTime;
   @ApiModelProperty("订单自动结算时间")
   private Integer ordAutomaticPay;
   @ApiModelProperty("是否允许离线消费")
   private Integer ifOffLinePay;
   @ApiModelProperty("报警时长")
   private Integer alarmTime;
   @ApiModelProperty("勺子重量")
   private Integer spoonWeight;
   @ApiModelProperty("心跳包时间(电子菜排)")
   private Long heartBeatTime;
   @ApiModelProperty("轮播播放时间(电子菜排)")
   private Long carouselTime;
   @ApiModelProperty("字幕标语(电子菜排)")
   private String titleSlogan;
   @ApiModelProperty("字体大小(电子菜排)")
   private Integer fontSize;
   @ApiModelProperty("界面样式(电子菜排)")
   private Integer guiStyle;
   @ApiModelProperty("设备背景或轮播图片")
   private JsonNode imageMap;
   @ApiModelProperty("字体颜色，默认黑色")
   private String fontColor;
   @ApiModelProperty("字体行数")
   private Integer lineNum;
   @ApiModelProperty("刷脸设备单次扣款金额")
   private Integer oncePayAmount;
   @ApiModelProperty("单笔订单开门数量")
   private Integer ordOpenLimit;
   @ApiModelProperty("单个柜门存单上限")
   private Integer detailNumLimit;
   @ApiModelProperty("第三方终端sn")
   private String terminalSn;
   @ApiModelProperty("第三方终端秘钥")
   private String terminalKey;
   @ApiModelProperty("打印机key")
   private String priKey;
   @ApiModelProperty("闸机默认消费金额")
   private Integer gateDefaultAmount;
   @ApiModelProperty("乐观锁")
   private Integer revision;
   @ApiModelProperty("创建人")
   private String crby;
   @ApiModelProperty("设备状态正常1、异常2")
   private Integer deviceState;
   @ApiModelProperty("创建时间")
   @JsonSerialize(
      using = DateTimeSerializer.YYYY_MM_DD_HH_MM_SS.class
   )
   @JsonDeserialize(
      using = DateTimeDeserializer.class
   )
   private LocalDateTime crtime;
   @ApiModelProperty("更新人")
   private String upby;
   @ApiModelProperty("更新时间")
   @JsonSerialize(
      using = DateTimeSerializer.YYYY_MM_DD_HH_MM_SS.class
   )
   @JsonDeserialize(
      using = DateTimeDeserializer.class
   )
   private LocalDateTime uptime;

//   public boolean supportMqtt() {
//      return DeviceStrategy.supportsMQTT(this.deviceType, this.versionCode);
//   }
//
//   public DeviceInfoInSystem convertToSystem() {
//      DeviceInfoInSystem deviceInfoInSystemEntity = new DeviceInfoInSystem();
//      deviceInfoInSystemEntity.setDeviceId(this.getDeviceId());
//      deviceInfoInSystemEntity.setDeviceSn(this.getDeviceSn());
//      deviceInfoInSystemEntity.setTenantId(TenantContextHolder.getTenantId());
//      return deviceInfoInSystemEntity;
//   }

   public Long getDeviceId() {
      return this.deviceId;
   }

   public Long getEffId() {
      return this.effId;
   }

   public String getDeviceSn() {
      return this.deviceSn;
   }

   public String getDeviceName() {
      return this.deviceName;
   }

   public String getDeviceNum() {
      return this.deviceNum;
   }

   public String getDeviceModel() {
      return this.deviceModel;
   }

   public Integer getDeviceType() {
      return this.deviceType;
   }

   public String getDevicePwd() {
      return this.devicePwd;
   }

   public String getDeviceAddr() {
      return this.deviceAddr;
   }

   public String getDeviceKey() {
      return this.deviceKey;
   }

   public Long getDeviceParentId() {
      return this.deviceParentId;
   }

   public String getDeviceParentType() {
      return this.deviceParentType;
   }

   public String getDeviceServiceIp() {
      return this.deviceServiceIp;
   }

   public String getDeviceServicePort() {
      return this.deviceServicePort;
   }

   public Integer getVersionCode() {
      return this.versionCode;
   }

   public String getVersionName() {
      return this.versionName;
   }

   public Integer getDeviceAgreement() {
      return this.deviceAgreement;
   }

   public Integer getOnlineState() {
      return this.onlineState;
   }

   public Integer getCommMode() {
      return this.commMode;
   }

   public String getDeviceIp() {
      return this.deviceIp;
   }

   public String getDeviceMask() {
      return this.deviceMask;
   }

   public String getDeviceMac() {
      return this.deviceMac;
   }

   public String getDeviceGateway() {
      return this.deviceGateway;
   }

   public String getFirstDns() {
      return this.firstDns;
   }

   public String getNextDns() {
      return this.nextDns;
   }

   public Integer getIfEnable() {
      return this.ifEnable;
   }

   public String getImgUrl() {
      return this.imgUrl;
   }

   public Integer getDataStatus() {
      return this.dataStatus;
   }

   public Integer getConsumMode() {
      return this.consumMode;
   }

   public Integer getIfQuotaLimit() {
      return this.ifQuotaLimit;
   }

   public Integer getIfDiscount() {
      return this.ifDiscount;
   }

   public Integer getIfTimeLimit() {
      return this.ifTimeLimit;
   }

   public Integer getIfUseCallNum() {
      return this.ifUseCallNum;
   }

   public Integer getAmountNotify() {
      return this.amountNotify;
   }

   public Integer getBindingValidTime() {
      return this.bindingValidTime;
   }

   public Integer getOrdAutomaticPay() {
      return this.ordAutomaticPay;
   }

   public Integer getIfOffLinePay() {
      return this.ifOffLinePay;
   }

   public Integer getAlarmTime() {
      return this.alarmTime;
   }

   public Integer getSpoonWeight() {
      return this.spoonWeight;
   }

   public Long getHeartBeatTime() {
      return this.heartBeatTime;
   }

   public Long getCarouselTime() {
      return this.carouselTime;
   }

   public String getTitleSlogan() {
      return this.titleSlogan;
   }

   public Integer getFontSize() {
      return this.fontSize;
   }

   public Integer getGuiStyle() {
      return this.guiStyle;
   }

   public JsonNode getImageMap() {
      return this.imageMap;
   }

   public String getFontColor() {
      return this.fontColor;
   }

   public Integer getLineNum() {
      return this.lineNum;
   }

   public Integer getOncePayAmount() {
      return this.oncePayAmount;
   }

   public Integer getOrdOpenLimit() {
      return this.ordOpenLimit;
   }

   public Integer getDetailNumLimit() {
      return this.detailNumLimit;
   }

   public String getTerminalSn() {
      return this.terminalSn;
   }

   public String getTerminalKey() {
      return this.terminalKey;
   }

   public String getPriKey() {
      return this.priKey;
   }

   public Integer getGateDefaultAmount() {
      return this.gateDefaultAmount;
   }

   public Integer getRevision() {
      return this.revision;
   }

   public String getCrby() {
      return this.crby;
   }

   public Integer getDeviceState() {
      return this.deviceState;
   }

   public LocalDateTime getCrtime() {
      return this.crtime;
   }

   public String getUpby() {
      return this.upby;
   }

   public LocalDateTime getUptime() {
      return this.uptime;
   }

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

   public void setEffId(final Long effId) {
      this.effId = effId;
   }

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

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

   public void setDeviceNum(final String deviceNum) {
      this.deviceNum = deviceNum;
   }

   public void setDeviceModel(final String deviceModel) {
      this.deviceModel = deviceModel;
   }

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

   public void setDevicePwd(final String devicePwd) {
      this.devicePwd = devicePwd;
   }

   public void setDeviceAddr(final String deviceAddr) {
      this.deviceAddr = deviceAddr;
   }

   public void setDeviceKey(final String deviceKey) {
      this.deviceKey = deviceKey;
   }

   public void setDeviceParentId(final Long deviceParentId) {
      this.deviceParentId = deviceParentId;
   }

   public void setDeviceParentType(final String deviceParentType) {
      this.deviceParentType = deviceParentType;
   }

   public void setDeviceServiceIp(final String deviceServiceIp) {
      this.deviceServiceIp = deviceServiceIp;
   }

   public void setDeviceServicePort(final String deviceServicePort) {
      this.deviceServicePort = deviceServicePort;
   }

   public void setVersionCode(final Integer versionCode) {
      this.versionCode = versionCode;
   }

   public void setVersionName(final String versionName) {
      this.versionName = versionName;
   }

   public void setDeviceAgreement(final Integer deviceAgreement) {
      this.deviceAgreement = deviceAgreement;
   }

   public void setOnlineState(final Integer onlineState) {
      this.onlineState = onlineState;
   }

   public void setCommMode(final Integer commMode) {
      this.commMode = commMode;
   }

   public void setDeviceIp(final String deviceIp) {
      this.deviceIp = deviceIp;
   }

   public void setDeviceMask(final String deviceMask) {
      this.deviceMask = deviceMask;
   }

   public void setDeviceMac(final String deviceMac) {
      this.deviceMac = deviceMac;
   }

   public void setDeviceGateway(final String deviceGateway) {
      this.deviceGateway = deviceGateway;
   }

   public void setFirstDns(final String firstDns) {
      this.firstDns = firstDns;
   }

   public void setNextDns(final String nextDns) {
      this.nextDns = nextDns;
   }

   public void setIfEnable(final Integer ifEnable) {
      this.ifEnable = ifEnable;
   }

   public void setImgUrl(final String imgUrl) {
      this.imgUrl = imgUrl;
   }

   public void setDataStatus(final Integer dataStatus) {
      this.dataStatus = dataStatus;
   }

   public void setConsumMode(final Integer consumMode) {
      this.consumMode = consumMode;
   }

   public void setIfQuotaLimit(final Integer ifQuotaLimit) {
      this.ifQuotaLimit = ifQuotaLimit;
   }

   public void setIfDiscount(final Integer ifDiscount) {
      this.ifDiscount = ifDiscount;
   }

   public void setIfTimeLimit(final Integer ifTimeLimit) {
      this.ifTimeLimit = ifTimeLimit;
   }

   public void setIfUseCallNum(final Integer ifUseCallNum) {
      this.ifUseCallNum = ifUseCallNum;
   }

   public void setAmountNotify(final Integer amountNotify) {
      this.amountNotify = amountNotify;
   }

   public void setBindingValidTime(final Integer bindingValidTime) {
      this.bindingValidTime = bindingValidTime;
   }

   public void setOrdAutomaticPay(final Integer ordAutomaticPay) {
      this.ordAutomaticPay = ordAutomaticPay;
   }

   public void setIfOffLinePay(final Integer ifOffLinePay) {
      this.ifOffLinePay = ifOffLinePay;
   }

   public void setAlarmTime(final Integer alarmTime) {
      this.alarmTime = alarmTime;
   }

   public void setSpoonWeight(final Integer spoonWeight) {
      this.spoonWeight = spoonWeight;
   }

   public void setHeartBeatTime(final Long heartBeatTime) {
      this.heartBeatTime = heartBeatTime;
   }

   public void setCarouselTime(final Long carouselTime) {
      this.carouselTime = carouselTime;
   }

   public void setTitleSlogan(final String titleSlogan) {
      this.titleSlogan = titleSlogan;
   }

   public void setFontSize(final Integer fontSize) {
      this.fontSize = fontSize;
   }

   public void setGuiStyle(final Integer guiStyle) {
      this.guiStyle = guiStyle;
   }

   public void setImageMap(final JsonNode imageMap) {
      this.imageMap = imageMap;
   }

   public void setFontColor(final String fontColor) {
      this.fontColor = fontColor;
   }

   public void setLineNum(final Integer lineNum) {
      this.lineNum = lineNum;
   }

   public void setOncePayAmount(final Integer oncePayAmount) {
      this.oncePayAmount = oncePayAmount;
   }

   public void setOrdOpenLimit(final Integer ordOpenLimit) {
      this.ordOpenLimit = ordOpenLimit;
   }

   public void setDetailNumLimit(final Integer detailNumLimit) {
      this.detailNumLimit = detailNumLimit;
   }

   public void setTerminalSn(final String terminalSn) {
      this.terminalSn = terminalSn;
   }

   public void setTerminalKey(final String terminalKey) {
      this.terminalKey = terminalKey;
   }

   public void setPriKey(final String priKey) {
      this.priKey = priKey;
   }

   public void setGateDefaultAmount(final Integer gateDefaultAmount) {
      this.gateDefaultAmount = gateDefaultAmount;
   }

   public void setRevision(final Integer revision) {
      this.revision = revision;
   }

   public void setCrby(final String crby) {
      this.crby = crby;
   }

   public void setDeviceState(final Integer deviceState) {
      this.deviceState = deviceState;
   }

   @JsonDeserialize(
      using = DateTimeDeserializer.class
   )
   public void setCrtime(final LocalDateTime crtime) {
      this.crtime = crtime;
   }

   public void setUpby(final String upby) {
      this.upby = upby;
   }

   @JsonDeserialize(
      using = DateTimeDeserializer.class
   )
   public void setUptime(final LocalDateTime uptime) {
      this.uptime = uptime;
   }
}
