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

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;

import java.util.Collection;

public class DeviceSearchDTO {
   @ApiModelProperty("食堂ID")
   private Long canteenId;
   @ApiModelProperty("店铺档口id")
   private Long stallId;
   @ApiModelProperty("餐线ID")
   private Long mealLineId;
   @ApiModelProperty("菜谱id")
   private Long recipeId;
   @ApiModelProperty("设备sn码")
   private String deviceSn;
   @ApiModelProperty("设备编号")
   private String deviceNum;
   @ApiModelProperty("设备名称")
   private String deviceName;
   @ApiModelProperty("设备型号")
   private String deviceModel;
   @ApiModelProperty("设备类型")
   private Integer deviceType;
   @ApiModelProperty("关联设备id")
   private Long deviceParentId;
   @ApiModelProperty("模糊查询(sn,设备编号,设备名称)")
   private String deviceSearchInfo;
   @ApiModelProperty("设备状态 1在线 2离线（非数据库查询）")
   private String deviceState;
   @ApiModelProperty("设备状态 1在线 2离线（非数据库查询）")
   private Integer onlineState;
   @ApiModelProperty(
      value = "设备SN范围",
      hidden = true
   )
   private Collection<String> deviceSnList;
   @ApiModelProperty(
      value = "设备ID范围",
      hidden = true
   )
   private Collection<Long> deviceIdList;
   @ApiModelProperty(
      value = "设备编号范围",
      hidden = true
   )
   private Collection<String> deviceNumList;
   @ApiModelProperty(
      value = "设备类型",
      hidden = true
   )
   private Collection<Integer> deviceTypeList;
   @ApiModelProperty(
      value = "食堂ID范围",
      hidden = true
   )
   private Collection<Long> canteenIdList;
   @ApiModelProperty(
      value = "店铺档口id范围",
      hidden = true
   )
   private Collection<Long> stallIdList;
   @ApiModelProperty(
      value = "餐线id范围",
      hidden = true
   )
   private Collection<Long> mealLineIdList;
   @ApiModelProperty(
      value = "区域id范围",
      hidden = true
   )
   private Collection<Long> areaIdList;
   @ApiModelProperty(
      value = "食堂ID店铺档口id范围范围权限",
      hidden = true
   )
   private Collection<Long> canteenStallIdListPermission;
   @ApiModelProperty("是否是商家管理员")
   private Boolean isAdmin;
   @ApiModelProperty("用户id")
   private Long userId;
   @ApiModelProperty("排序字段")
   private String orderByName;
   @ApiModelProperty("true增序 false降序")
   private Boolean asc;
   @ApiModelProperty("设备是否启用 1-是 2-否")
   private Integer ifEnable;

   public Collection<String> getDeviceSnList() {
      return CollUtil.isEmpty(this.deviceSnList) && StrUtil.isNotEmpty(this.deviceSn) ? ListUtil.toList(new String[]{this.deviceSn}) : ListUtil.toList(this.deviceSnList);
   }

   public Collection<Long> getCanteenIdList() {
      return CollUtil.isEmpty(this.canteenIdList) && this.canteenId != null ? ListUtil.toList(new Long[]{this.canteenId}) : ListUtil.toList(this.canteenIdList);
   }

   public Collection<Long> getStallIdList() {
      return CollUtil.isEmpty(this.stallIdList) && this.stallId != null ? ListUtil.toList(new Long[]{this.stallId}) : ListUtil.toList(this.stallIdList);
   }

   public Collection<Long> getMealLineIdList() {
      return CollUtil.isEmpty(this.mealLineIdList) && this.mealLineId != null ? ListUtil.toList(new Long[]{this.mealLineId}) : ListUtil.toList(this.mealLineIdList);
   }

   public Collection<Integer> getDeviceTypeList() {
      return CollUtil.isEmpty(this.deviceTypeList) && this.deviceType != null ? ListUtil.toList(new Integer[]{this.deviceType}) : ListUtil.toList(this.deviceTypeList);
   }

   public Collection<String> getDeviceNumList() {
      return CollUtil.isEmpty(this.deviceNumList) && StrUtil.isNotEmpty(this.deviceNum) ? ListUtil.toList(new String[]{this.deviceNum}) : ListUtil.toList(this.deviceNumList);
   }

   public Boolean getNeedSearchBind() {
      return this.recipeId != null || CollUtil.isNotEmpty(this.getCanteenIdList()) || CollUtil.isNotEmpty(this.getStallIdList()) || CollUtil.isNotEmpty(this.getCanteenStallIdListPermission());
   }

   public Long getCanteenId() {
      return this.canteenId;
   }

   public Long getStallId() {
      return this.stallId;
   }

   public Long getMealLineId() {
      return this.mealLineId;
   }

   public Long getRecipeId() {
      return this.recipeId;
   }

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

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

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

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

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

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

   public String getDeviceSearchInfo() {
      return this.deviceSearchInfo;
   }

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

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

   public Collection<Long> getDeviceIdList() {
      return this.deviceIdList;
   }

   public Collection<Long> getAreaIdList() {
      return this.areaIdList;
   }

   public Collection<Long> getCanteenStallIdListPermission() {
      return this.canteenStallIdListPermission;
   }

   public Boolean getIsAdmin() {
      return this.isAdmin;
   }

   public Long getUserId() {
      return this.userId;
   }

   public String getOrderByName() {
      return this.orderByName;
   }

   public Boolean getAsc() {
      return this.asc;
   }

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

   public DeviceSearchDTO setCanteenId(final Long canteenId) {
      this.canteenId = canteenId;
      return this;
   }

   public DeviceSearchDTO setStallId(final Long stallId) {
      this.stallId = stallId;
      return this;
   }

   public DeviceSearchDTO setMealLineId(final Long mealLineId) {
      this.mealLineId = mealLineId;
      return this;
   }

   public DeviceSearchDTO setRecipeId(final Long recipeId) {
      this.recipeId = recipeId;
      return this;
   }

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

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

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

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

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

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

   public DeviceSearchDTO setDeviceSearchInfo(final String deviceSearchInfo) {
      this.deviceSearchInfo = deviceSearchInfo;
      return this;
   }

   public DeviceSearchDTO setDeviceState(final String deviceState) {
      this.deviceState = deviceState;
      return this;
   }

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

   public DeviceSearchDTO setDeviceSnList(final Collection<String> deviceSnList) {
      this.deviceSnList = deviceSnList;
      return this;
   }

   public DeviceSearchDTO setDeviceIdList(final Collection<Long> deviceIdList) {
      this.deviceIdList = deviceIdList;
      return this;
   }

   public DeviceSearchDTO setDeviceNumList(final Collection<String> deviceNumList) {
      this.deviceNumList = deviceNumList;
      return this;
   }

   public DeviceSearchDTO setDeviceTypeList(final Collection<Integer> deviceTypeList) {
      this.deviceTypeList = deviceTypeList;
      return this;
   }

   public DeviceSearchDTO setCanteenIdList(final Collection<Long> canteenIdList) {
      this.canteenIdList = canteenIdList;
      return this;
   }

   public DeviceSearchDTO setStallIdList(final Collection<Long> stallIdList) {
      this.stallIdList = stallIdList;
      return this;
   }

   public DeviceSearchDTO setMealLineIdList(final Collection<Long> mealLineIdList) {
      this.mealLineIdList = mealLineIdList;
      return this;
   }

   public DeviceSearchDTO setAreaIdList(final Collection<Long> areaIdList) {
      this.areaIdList = areaIdList;
      return this;
   }

   public DeviceSearchDTO setCanteenStallIdListPermission(final Collection<Long> canteenStallIdListPermission) {
      this.canteenStallIdListPermission = canteenStallIdListPermission;
      return this;
   }

   public DeviceSearchDTO setIsAdmin(final Boolean isAdmin) {
      this.isAdmin = isAdmin;
      return this;
   }

   public DeviceSearchDTO setUserId(final Long userId) {
      this.userId = userId;
      return this;
   }

   public DeviceSearchDTO setOrderByName(final String orderByName) {
      this.orderByName = orderByName;
      return this;
   }

   public DeviceSearchDTO setAsc(final Boolean asc) {
      this.asc = asc;
      return this;
   }

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