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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.NumberUtil;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.canteen.core.order.common.model.OrderDelivery;
import com.bonus.canteen.core.order.common.model.OrderInfo;
import io.swagger.annotations.ApiModelProperty;

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

public class OrderInfoAndroidVO {
   @ApiModelProperty("商家订单号")
   private Long orderId;
   @ApiModelProperty("设备订单号（设备下单时）")
   private String macOrderId;
   @ApiModelProperty("来源类型")
   private Integer sourceType;
   @ApiModelProperty("订单日期(区别于下单时间)")
   private LocalDate orderDate;
   @ApiModelProperty("食堂id")
   private Long canteenId;
   @ApiModelProperty("食堂名称")
   private String canteenName;
   @ApiModelProperty("档口id")
   private Long stallId;
   @ApiModelProperty("档口名称")
   private String stallName;
   @ApiModelProperty("餐次id")
   private Long mealtimeType;
   @ApiModelProperty("餐次名称")
   private String mealtimeName;
   @ApiModelProperty("设备序列号（设备下单时）")
   private String machineSn;
   @ApiModelProperty("取餐码/叫号码")
   private String mealCode;
   @ApiModelProperty("订单总金额 单位为分")
   private BigDecimal payableAmount;
   @ApiModelProperty("打折减免 单位为分")
   private BigDecimal discountsAmount;
   @ApiModelProperty("餐券抵扣金额 单位为分")
   private BigDecimal couponAmount;
   @ApiModelProperty("配送费 单位为分")
   private BigDecimal deliveryAmount;
   @ApiModelProperty("包装费")
   private BigDecimal packingAmount;
   @ApiModelProperty("实际付款金额 单位为分")
   private BigDecimal realAmount;
   @ApiModelProperty("实际应付款金额 单位为分")
   private BigDecimal needPayAmount;
   @ApiModelProperty("已退款金额")
   private BigDecimal refundAmount;
   @ApiModelProperty("下单时间")
   private LocalDateTime orderTime;
   @ApiModelProperty("支付时间")
   private LocalDateTime payTime;
   @ApiModelProperty("支付方式")
   private Integer payType;
   @ApiModelProperty("支付状态 1 未支付 2 支付中  3 支付成功  4 支付失败  5 支付关闭")
   private Integer payState;
   @ApiModelProperty("扣款类型 1 下单扣款 2 核销扣款")
   private Integer deductionType;
   @ApiModelProperty("订单类型 1 当餐 2 预订餐 3 报餐 4 商城 11 设备 12 自助餐 21 补扣 22 外部订单")
   private Integer orderType;
   @ApiModelProperty("订单状态 1 已下单 2 已完成 3 已取消")
   private Integer orderState;
   private Integer dishesState;
   @ApiModelProperty("订单退款状态 1 未申请 2 已退单 3 部分退单")
   private Integer orderRefundState;
   @ApiModelProperty("评价状态 1 已评价 2 未评价")
   private Integer commentState;
   @ApiModelProperty("审核状态 1 待审核 2 审核通过 3 审核失败")
   private Integer checkState;
   @ApiModelProperty("配送方式 1-自取堂食 2-商家配送 3-取餐柜配送 4-生鲜柜配送 5-自取外带 6-取餐点自取")
   private Integer deliveryType;
   @ApiModelProperty("订单图片")
   private String imgUrl;
   @ApiModelProperty("订单备注")
   private String remark;
   @ApiModelProperty("收货人姓名")
   private String consigneeName;
   @ApiModelProperty("收货人手机号")
   private String consigneeMobile;
   @ApiModelProperty("收货人地址")
   private String consigneeAddress;
   @ApiModelProperty("订单明细list")
   private List<OrderDetailAndroidVO> orderDetailList;

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

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

   public void fillDeliveryInfo(OrderDelivery orderDelivery) {
      this.consigneeName = orderDelivery.getConsigneeName();
      this.consigneeMobile = orderDelivery.getConsigneeMobile();
      this.consigneeAddress = orderDelivery.getConsigneeAddress();
   }

   public static OrderInfoAndroidVO of(OrderInfo orderInfo) {
      OrderInfoAndroidVO vo = (OrderInfoAndroidVO)BeanUtil.copyProperties(orderInfo, OrderInfoAndroidVO.class, new String[0]);
      return vo;
   }

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

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

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

   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 Long 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;
   }

   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 Integer getDeliveryType() {
      return this.deliveryType;
   }

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

   public String getConsigneeName() {
      return this.consigneeName;
   }

   public String getConsigneeMobile() {
      return this.consigneeMobile;
   }

   public String getConsigneeAddress() {
      return this.consigneeAddress;
   }

   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 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 setMealtimeType(final Long 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;
   }

   public void setOrderState(final Integer orderState) {
      this.orderState = orderState;
   }

   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 setDeliveryType(final Integer deliveryType) {
      this.deliveryType = deliveryType;
   }

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

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

   public void setConsigneeName(final String consigneeName) {
      this.consigneeName = consigneeName;
   }

   public void setConsigneeMobile(final String consigneeMobile) {
      this.consigneeMobile = consigneeMobile;
   }

   public void setConsigneeAddress(final String consigneeAddress) {
      this.consigneeAddress = consigneeAddress;
   }

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