package com.bonus.canteen.core.order.deprecated.vo;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bonus.canteen.core.common.encrypt.HandleType;
import com.bonus.canteen.core.common.encrypt.LeNiuDecryptDataProcess;
import com.bonus.canteen.core.common.encrypt.LeNiuDecryptField;
import com.bonus.canteen.core.order.deprecated.constants.OrderStateOldEnum;
import io.swagger.annotations.ApiModelProperty;

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

@LeNiuDecryptDataProcess
public class MacMarketOrdInfoVO {
   @ApiModelProperty("商家订单号")
   private Long ordId;
   @ApiModelProperty("商品数量")
   private Integer goodsCount;
   @ApiModelProperty("实际付款金额 单位为分")
   private Integer realAmount;
   @ApiModelProperty("人员编号")
   private String custNum;
   @LeNiuDecryptField
   @ApiModelProperty("人员姓名")
   private String custName;
   @LeNiuDecryptField(HandleType.DESENSITIZE_MOBILE_PHONE)
   @ApiModelProperty("手机号")
   private String mobile;
   @ApiModelProperty("机构全称")
   private String orgFullName;
   @ApiModelProperty("订单日期(区别于下单时间)")
   @ExcelProperty(
      value = {"订单日期"},
      order = 3
   )
   private LocalDate ordGoodsDate;
   @ApiModelProperty("下单时间")
   private LocalDateTime ordTime;
   @ApiModelProperty("订单状态 接受单、拒绝订单、取消、退款、完成")
   private Integer ordState;
   @ApiModelProperty("退单状态 1 未退单 2 已退单 3 部分退单")
   private Integer ordRefundState;
   private Integer dishesState;
   private String goodsName;
   private Integer ifWriteOff;
   @ApiModelProperty("配送方式 1:自取堂食, 2:商家配送")
   private Integer deliveryType;
   @ApiModelProperty("订单明细")
   private List<OrdDetailMachineVO> ordDetailList;

   public Integer getGoodsCount() {
      return CollUtil.isEmpty(this.ordDetailList) ? 0 : (Integer)this.ordDetailList.stream().map(OrdDetailMachineVO::getQuantity).reduce(0, Integer::sum);
   }

   public Integer getOrdState() {
      return OrderStateOldEnum.convertByNewOrderState(this.ordState, this.ordRefundState, this.dishesState);
   }

   public Long getOrdId() {
      return this.ordId;
   }

   public Integer getRealAmount() {
      return this.realAmount;
   }

   public String getCustNum() {
      return this.custNum;
   }

   public String getCustName() {
      return this.custName;
   }

   public String getMobile() {
      return this.mobile;
   }

   public String getOrgFullName() {
      return this.orgFullName;
   }

   public LocalDate getOrdGoodsDate() {
      return this.ordGoodsDate;
   }

   public LocalDateTime getOrdTime() {
      return this.ordTime;
   }

   public Integer getOrdRefundState() {
      return this.ordRefundState;
   }

   public Integer getDishesState() {
      return this.dishesState;
   }

   public String getGoodsName() {
      return this.goodsName;
   }

   public Integer getIfWriteOff() {
      return this.ifWriteOff;
   }

   public Integer getDeliveryType() {
      return this.deliveryType;
   }

   public List<OrdDetailMachineVO> getOrdDetailList() {
      return this.ordDetailList;
   }

   public void setOrdId(final Long ordId) {
      this.ordId = ordId;
   }

   public void setGoodsCount(final Integer goodsCount) {
      this.goodsCount = goodsCount;
   }

   public void setRealAmount(final Integer realAmount) {
      this.realAmount = realAmount;
   }

   public void setCustNum(final String custNum) {
      this.custNum = custNum;
   }

   public void setCustName(final String custName) {
      this.custName = custName;
   }

   public void setMobile(final String mobile) {
      this.mobile = mobile;
   }

   public void setOrgFullName(final String orgFullName) {
      this.orgFullName = orgFullName;
   }

   public void setOrdGoodsDate(final LocalDate ordGoodsDate) {
      this.ordGoodsDate = ordGoodsDate;
   }

   public void setOrdTime(final LocalDateTime ordTime) {
      this.ordTime = ordTime;
   }

   public void setOrdState(final Integer ordState) {
      this.ordState = ordState;
   }

   public void setOrdRefundState(final Integer ordRefundState) {
      this.ordRefundState = ordRefundState;
   }

   public void setDishesState(final Integer dishesState) {
      this.dishesState = dishesState;
   }

   public void setGoodsName(final String goodsName) {
      this.goodsName = goodsName;
   }

   public void setIfWriteOff(final Integer ifWriteOff) {
      this.ifWriteOff = ifWriteOff;
   }

   public void setDeliveryType(final Integer deliveryType) {
      this.deliveryType = deliveryType;
   }

   public void setOrdDetailList(final List<OrdDetailMachineVO> ordDetailList) {
      this.ordDetailList = ordDetailList;
   }

}
