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

import cn.hutool.core.util.StrUtil;
import com.bonus.canteen.core.common.page.PageDTO;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;

public class OrderPreBookQueryDTO extends PageDTO {
   @ApiModelProperty("订单日期")
   private LocalDate orderDate;
   @ApiModelProperty("订单月份")
   private String orderMonth;
   @ApiModelProperty("用户搜索条件")
   private String custSearchInfo;
   @ApiModelProperty("组织机构范围")
   private List<Long> orgIdList;
   @ApiModelProperty("导出字段")
   private List<String> exportCols;

   public @NotNull(
   message = "查询时间不能为空"
) LocalDate getOrderDate() {
      if (this.orderDate != null) {
         return this.orderDate;
      } else {
         return StrUtil.isNotEmpty(this.orderMonth) ? LocalDate.parse(this.orderMonth + "-01") : null;
      }
   }

   public String getOrderMonth() {
      return this.orderMonth;
   }

   public String getCustSearchInfo() {
      return this.custSearchInfo;
   }

   public List<Long> getOrgIdList() {
      return this.orgIdList;
   }

   public List<String> getExportCols() {
      return this.exportCols;
   }

   public void setOrderDate(final LocalDate orderDate) {
      this.orderDate = orderDate;
   }

   public void setOrderMonth(final String orderMonth) {
      this.orderMonth = orderMonth;
   }

   public void setCustSearchInfo(final String custSearchInfo) {
      this.custSearchInfo = custSearchInfo;
   }

   public void setOrgIdList(final List<Long> orgIdList) {
      this.orgIdList = orgIdList;
   }

   public void setExportCols(final List<String> exportCols) {
      this.exportCols = exportCols;
   }

}
