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

import cn.hutool.core.util.NumberUtil;
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.common.utils.SysUtil;
import com.bonus.canteen.core.order.utils.LeNumUtil;
import com.bonus.canteen.core.order.common.constants.*;

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

@LeNiuDecryptDataProcess
public class OrderListAndroidVO {
   private Long orderId;
   private String macOrderId;
   private Integer sourceType;
   private String plateSerialNum;
   private String plateNum;
   private Long custId;
   @LeNiuDecryptField
   private String custName;
   private String custNum;
   @LeNiuDecryptField(HandleType.DESENSITIZE_MOBILE_PHONE)
   private String mobile;
   private LocalDate orderDate;
   private Long canteenId;
   private String canteenName;
   private Long stallId;
   private String stallName;
   private String permissionCode;
   private Integer mealtimeType;
   private String mealtimeName;
   private String machineSn;
   private String mealCode;
   private BigDecimal payableAmount;
   private BigDecimal discountsAmount;
   private BigDecimal couponAmount;
   private BigDecimal deliveryAmount;
   private BigDecimal packingAmount;
   private BigDecimal realAmount;
   private BigDecimal needPayAmount;
   private BigDecimal refundAmount;
   private LocalDateTime orderTime;
   private LocalDateTime payTime;
   private Integer payType;
   private Integer payState;
   private Integer deductionType;
   private Integer orderType;
   /** @deprecated */
   private Integer orderState;
   private Integer orderStateMix;
   private Integer dishesState;
   private Integer orderRefundState;
   private Integer commentState;
   private Integer checkState;
   private String imgUrl;
   private String remark;
   private Integer goodsCount;
   private Integer ifOnline;
   private Integer payChannel;
   private List<OrderDetailAndroidVO> orderDetailList;

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

   public BigDecimal getNeedPayAmount() {
      return NumberUtil.sub(this.payableAmount, this.discountsAmount);
   }

   public Integer getOrderStateMix() {
      return OrderStateMixEnum.mixStateBy(this.orderState, this.payState, this.orderRefundState);
   }

   public Integer getGoodsCount() {
      return this.orderDetailList == null ? 0 : LeNumUtil.sumField(this.orderDetailList, (s) -> {
         return NumberUtil.toBigDecimal(s.getQuantity());
      }).intValue();
   }

   public BigDecimal calcNeedPayAmount() {
      return NumberUtil.sub(this.payableAmount, this.discountsAmount);
   }

   public Long getOrderId() {
      return this.orderId;
   }

   public String getMacOrderId() {
      return this.macOrderId;
   }

   public Integer getSourceType() {
      return this.sourceType;
   }

   public String getPlateSerialNum() {
      return this.plateSerialNum;
   }

   public String getPlateNum() {
      return this.plateNum;
   }

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

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

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

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

   public LocalDate getOrderDate() {
      return this.orderDate;
   }

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

   public String getCanteenName() {
      return this.canteenName;
   }

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

   public String getStallName() {
      return this.stallName;
   }

   public String getPermissionCode() {
      return this.permissionCode;
   }

   public Integer getMealtimeType() {
      return this.mealtimeType;
   }

   public String getMealtimeName() {
      return this.mealtimeName;
   }

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

   public String getMealCode() {
      return this.mealCode;
   }

   public BigDecimal getPayableAmount() {
      return this.payableAmount;
   }

   public BigDecimal getDiscountsAmount() {
      return this.discountsAmount;
   }

   public BigDecimal getCouponAmount() {
      return this.couponAmount;
   }

   public BigDecimal getDeliveryAmount() {
      return this.deliveryAmount;
   }

   public BigDecimal getPackingAmount() {
      return this.packingAmount;
   }

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

   public BigDecimal getRefundAmount() {
      return this.refundAmount;
   }

   public LocalDateTime getOrderTime() {
      return this.orderTime;
   }

   public LocalDateTime getPayTime() {
      return this.payTime;
   }

   public Integer getPayType() {
      return this.payType;
   }

   public Integer getPayState() {
      return this.payState;
   }

   public Integer getDeductionType() {
      return this.deductionType;
   }

   public Integer getOrderType() {
      return this.orderType;
   }

   /** @deprecated */
   @Deprecated
   public Integer getOrderState() {
      return this.orderState;
   }

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

   public Integer getOrderRefundState() {
      return this.orderRefundState;
   }

   public Integer getCommentState() {
      return this.commentState;
   }

   public Integer getCheckState() {
      return this.checkState;
   }

   public String getRemark() {
      return this.remark;
   }

   public Integer getIfOnline() {
      return this.ifOnline;
   }

   public Integer getPayChannel() {
      return this.payChannel;
   }

   public List<OrderDetailAndroidVO> getOrderDetailList() {
      return this.orderDetailList;
   }

   public void setOrderId(final Long orderId) {
      this.orderId = orderId;
   }

   public void setMacOrderId(final String macOrderId) {
      this.macOrderId = macOrderId;
   }

   public void setSourceType(final Integer sourceType) {
      this.sourceType = sourceType;
   }

   public void setPlateSerialNum(final String plateSerialNum) {
      this.plateSerialNum = plateSerialNum;
   }

   public void setPlateNum(final String plateNum) {
      this.plateNum = plateNum;
   }

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

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

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

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

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

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

   public void setCanteenName(final String canteenName) {
      this.canteenName = canteenName;
   }

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

   public void setStallName(final String stallName) {
      this.stallName = stallName;
   }

   public void setPermissionCode(final String permissionCode) {
      this.permissionCode = permissionCode;
   }

   public void setMealtimeType(final Integer mealtimeType) {
      this.mealtimeType = mealtimeType;
   }

   public void setMealtimeName(final String mealtimeName) {
      this.mealtimeName = mealtimeName;
   }

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

   public void setMealCode(final String mealCode) {
      this.mealCode = mealCode;
   }

   public void setPayableAmount(final BigDecimal payableAmount) {
      this.payableAmount = payableAmount;
   }

   public void setDiscountsAmount(final BigDecimal discountsAmount) {
      this.discountsAmount = discountsAmount;
   }

   public void setCouponAmount(final BigDecimal couponAmount) {
      this.couponAmount = couponAmount;
   }

   public void setDeliveryAmount(final BigDecimal deliveryAmount) {
      this.deliveryAmount = deliveryAmount;
   }

   public void setPackingAmount(final BigDecimal packingAmount) {
      this.packingAmount = packingAmount;
   }

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

   public void setNeedPayAmount(final BigDecimal needPayAmount) {
      this.needPayAmount = needPayAmount;
   }

   public void setRefundAmount(final BigDecimal refundAmount) {
      this.refundAmount = refundAmount;
   }

   public void setOrderTime(final LocalDateTime orderTime) {
      this.orderTime = orderTime;
   }

   public void setPayTime(final LocalDateTime payTime) {
      this.payTime = payTime;
   }

   public void setPayType(final Integer payType) {
      this.payType = payType;
   }

   public void setPayState(final Integer payState) {
      this.payState = payState;
   }

   public void setDeductionType(final Integer deductionType) {
      this.deductionType = deductionType;
   }

   public void setOrderType(final Integer orderType) {
      this.orderType = orderType;
   }

   /** @deprecated */
   @Deprecated
   public void setOrderState(final Integer orderState) {
      this.orderState = orderState;
   }

   public void setOrderStateMix(final Integer orderStateMix) {
      this.orderStateMix = orderStateMix;
   }

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

   public void setOrderRefundState(final Integer orderRefundState) {
      this.orderRefundState = orderRefundState;
   }

   public void setCommentState(final Integer commentState) {
      this.commentState = commentState;
   }

   public void setCheckState(final Integer checkState) {
      this.checkState = checkState;
   }

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

   public void setRemark(final String remark) {
      this.remark = remark;
   }

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

   public void setIfOnline(final Integer ifOnline) {
      this.ifOnline = ifOnline;
   }

   public void setPayChannel(final Integer payChannel) {
      this.payChannel = payChannel;
   }

   public void setOrderDetailList(final List<OrderDetailAndroidVO> orderDetailList) {
      this.orderDetailList = orderDetailList;
   }
}
