package com.bonus.canteen.core.order.android.dto;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.bonus.canteen.core.common.page.PageDTO;
import com.bonus.canteen.core.order.common.constants.CheckStateEnum;
import com.bonus.canteen.core.order.common.dto.OrderSearchParam;
import com.bonus.canteen.core.order.common.query.OrderQueryParam;
import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDate;
import java.util.List;

public class OrderListAndroidQueryDTO extends PageDTO implements OrderQueryParam {
   @ApiModelProperty("核身方式")
   private Integer nuClearMode;
   @ApiModelProperty("人员id")
   private Long custId;
   @ApiModelProperty("支付宝uid")
   private String openId;
   @ApiModelProperty("物理卡号")
   private String serialNum;
   @ApiModelProperty("二维码")
   private String qrCode;
   private LocalDate startDate;
   private LocalDate endDate;
   private String machineSn;
   private String detailMachineSn;
   private String searchText;
   private String searchText2;
   private String searchText3;
   private String searchText4;
   private String searchText5;
   private List<Long> canteenIdList;
   private List<Long> stallIdList;
   private List<Long> roomIdList;
   private List<Integer> payTypeList;
   private List<Integer> payStateList;
   private List<Integer> orderRefundStateList;
   private List<Integer> orderTypeList;
   private List<Integer> orderStateList;
   private List<Integer> deliveryTypeList;
   private List<Integer> mealtimeTypeList;
   private List<Integer> dishesStateList;
   @ApiModelProperty("扩展字段")
   private JsonNode extParam;
   @JsonIgnore
   private Boolean existsUnCheckRefund = false;

   public OrderSearchParam convertToOrderSearchParam() {
      OrderSearchParam param = new OrderSearchParam();
      param.setCustId(this.custId);
      param.setStartDate(this.startDate);
      param.setEndDate(this.endDate);
      param.setMachineSnList(CharSequenceUtil.isNotBlank(this.machineSn) ? CollUtil.newArrayList(new String[]{this.machineSn}) : null);
      param.setDetailMachineSnList(CharSequenceUtil.isNotBlank(this.detailMachineSn) ? CollUtil.newArrayList(new String[]{this.detailMachineSn}) : null);
      param.setCanteenSearchInfo(this.searchText);
      param.setOrderSearchInfo(this.searchText2);
      param.setBuffetSearchInfo(this.searchText3);
      param.setCustSearchInfo(this.searchText4);
      param.setOrderIdSearchInfo(this.searchText5);
      param.setCanteenIdList(this.canteenIdList);
      param.setStallIdList(this.stallIdList);
      param.setRoomIdList(this.roomIdList);
      param.setPayTypeList(this.payTypeList);
      param.setPayStateList(this.payStateList);
      param.setOrderRefundStateList(this.orderRefundStateList);
      param.setOrderTypeList(this.orderTypeList);
      param.setOrderStateList(this.orderStateList);
      param.setDeliveryTypeList(this.deliveryTypeList);
      param.setMealtimeTypeList(this.mealtimeTypeList);
      param.setDishesStateList(this.dishesStateList);
      if (this.existsUnCheckRefund) {
         param.setExistsRefund(LeConstants.COMMON_YES);
         param.setCheckState(CheckStateEnum.WAIT.getKey());
      }

      return param;
   }

   public Integer getNuClearMode() {
      return this.nuClearMode;
   }

   public Long getCustId() {
      return this.custId;
   }

   public String getOpenId() {
      return this.openId;
   }

   public String getSerialNum() {
      return this.serialNum;
   }

   public String getQrCode() {
      return this.qrCode;
   }

   public LocalDate getStartDate() {
      return this.startDate;
   }

   public LocalDate getEndDate() {
      return this.endDate;
   }

   public String getMachineSn() {
      return this.machineSn;
   }

   public String getDetailMachineSn() {
      return this.detailMachineSn;
   }

   public String getSearchText() {
      return this.searchText;
   }

   public String getSearchText2() {
      return this.searchText2;
   }

   public String getSearchText3() {
      return this.searchText3;
   }

   public String getSearchText4() {
      return this.searchText4;
   }

   public String getSearchText5() {
      return this.searchText5;
   }

   public List<Long> getCanteenIdList() {
      return this.canteenIdList;
   }

   public List<Long> getStallIdList() {
      return this.stallIdList;
   }

   public List<Long> getRoomIdList() {
      return this.roomIdList;
   }

   public List<Integer> getPayTypeList() {
      return this.payTypeList;
   }

   public List<Integer> getPayStateList() {
      return this.payStateList;
   }

   public List<Integer> getOrderRefundStateList() {
      return this.orderRefundStateList;
   }

   public List<Integer> getOrderTypeList() {
      return this.orderTypeList;
   }

   public List<Integer> getOrderStateList() {
      return this.orderStateList;
   }

   public List<Integer> getDeliveryTypeList() {
      return this.deliveryTypeList;
   }

   public List<Integer> getMealtimeTypeList() {
      return this.mealtimeTypeList;
   }

   public List<Integer> getDishesStateList() {
      return this.dishesStateList;
   }

   public JsonNode getExtParam() {
      return this.extParam;
   }

   public Boolean getExistsUnCheckRefund() {
      return this.existsUnCheckRefund;
   }

   public void setNuClearMode(final Integer nuClearMode) {
      this.nuClearMode = nuClearMode;
   }

   public void setCustId(final Long custId) {
      this.custId = custId;
   }

   public void setOpenId(final String openId) {
      this.openId = openId;
   }

   public void setSerialNum(final String serialNum) {
      this.serialNum = serialNum;
   }

   public void setQrCode(final String qrCode) {
      this.qrCode = qrCode;
   }

   public void setStartDate(final LocalDate startDate) {
      this.startDate = startDate;
   }

   public void setEndDate(final LocalDate endDate) {
      this.endDate = endDate;
   }

   public void setMachineSn(final String machineSn) {
      this.machineSn = machineSn;
   }

   public void setDetailMachineSn(final String detailMachineSn) {
      this.detailMachineSn = detailMachineSn;
   }

   public void setSearchText(final String searchText) {
      this.searchText = searchText;
   }

   public void setSearchText2(final String searchText2) {
      this.searchText2 = searchText2;
   }

   public void setSearchText3(final String searchText3) {
      this.searchText3 = searchText3;
   }

   public void setSearchText4(final String searchText4) {
      this.searchText4 = searchText4;
   }

   public void setSearchText5(final String searchText5) {
      this.searchText5 = searchText5;
   }

   public void setCanteenIdList(final List<Long> canteenIdList) {
      this.canteenIdList = canteenIdList;
   }

   public void setStallIdList(final List<Long> stallIdList) {
      this.stallIdList = stallIdList;
   }

   public void setRoomIdList(final List<Long> roomIdList) {
      this.roomIdList = roomIdList;
   }

   public void setPayTypeList(final List<Integer> payTypeList) {
      this.payTypeList = payTypeList;
   }

   public void setPayStateList(final List<Integer> payStateList) {
      this.payStateList = payStateList;
   }

   public void setOrderRefundStateList(final List<Integer> orderRefundStateList) {
      this.orderRefundStateList = orderRefundStateList;
   }

   public void setOrderTypeList(final List<Integer> orderTypeList) {
      this.orderTypeList = orderTypeList;
   }

   public void setOrderStateList(final List<Integer> orderStateList) {
      this.orderStateList = orderStateList;
   }

   public void setDeliveryTypeList(final List<Integer> deliveryTypeList) {
      this.deliveryTypeList = deliveryTypeList;
   }

   public void setMealtimeTypeList(final List<Integer> mealtimeTypeList) {
      this.mealtimeTypeList = mealtimeTypeList;
   }

   public void setDishesStateList(final List<Integer> dishesStateList) {
      this.dishesStateList = dishesStateList;
   }

   public void setExtParam(final JsonNode extParam) {
      this.extParam = extParam;
   }

   @JsonIgnore
   public void setExistsUnCheckRefund(final Boolean existsUnCheckRefund) {
      this.existsUnCheckRefund = existsUnCheckRefund;
   }
}
