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

import com.bonus.canteen.core.device.manage.model.DeviceInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

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

@ApiModel("移动端订单列表VO")
public class OrderListMobileVO {
   @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("餐次类型")
   private String mealtimeType;
   @ApiModelProperty("餐次名称")
   private String mealtimeName;
   @ApiModelProperty("设备序列号（设备下单时）")
   private String machineSn;
   @ApiModelProperty("设备编号（设备下单时）")
   private String machineNum;
   @ApiModelProperty("设备名称（设备下单时）")
   private String machineName;
   @ApiModelProperty("托盘物理号（自助餐）")
   private String plateSerialNum;
   @ApiModelProperty("托盘编号")
   private String plateNum;
   @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("订单类型")
   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("退款时间")
   private LocalDateTime refundTime;
   @ApiModelProperty("订单图片")
   private String imgUrl;
   @ApiModelProperty("订单明细数量")
   private Integer orderDetailSum;
   private Integer orderStateMixMobile;
   @ApiModelProperty("订单明细list")
   private List<OrderDetailMobileVO> orderDetailList;

//   public String getImgUrl() {
//      return SysUtil.getCutFileUrl(this.imgUrl);
//   }
//
//   public Integer getOrderDetailSum() {
//      return CollUtil.size(this.orderDetailList);
//   }
//
//   public BigDecimal getNeedPayAmount() {
//      return NumberUtil.sub(this.payableAmount, this.discountsAmount);
//   }
//
//   public Integer getOrderStateMixMobile() {
//      return OrderStateMixMobileEnum.mixStateBy(this.orderState, this.payState, this.orderRefundState, this.dishesState);
//   }

   public void fillDeviceInfo(DeviceInfo deviceInfo) {
      if (deviceInfo != null) {
         this.machineSn = deviceInfo.getDeviceSn();
         this.machineNum = deviceInfo.getDeviceNum();
         this.machineName = deviceInfo.getDeviceName();
      }

   }
//
//   public static List<OrderListMobileVO> listOf(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList) {
//      if (CollUtil.isEmpty(orderInfoList)) {
//         return CollUtil.newArrayList(new OrderListMobileVO[0]);
//      } else {
//         List<OrderListMobileVO> orderListMobileVOList = BeanUtil.copyToList(orderInfoList, OrderListMobileVO.class);
//         if (CollUtil.isNotEmpty(orderDetailList)) {
//            Iterator var3 = orderListMobileVOList.iterator();
//
//            while(var3.hasNext()) {
//               OrderListMobileVO orderListMobileVO = (OrderListMobileVO)var3.next();
//               List<OrderDetailMobileVO> detailVOList = (List)orderDetailList.stream().filter((s) -> {
//                  return s.getOrderId().equals(orderListMobileVO.getOrderId());
//               }).map(OrderDetailMobileVO::of).collect(Collectors.toList());
//               orderListMobileVO.setOrderDetailList(detailVOList);
//            }
//         }
//
//         return orderListMobileVOList;
//      }
//   }

   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 String getMealtimeType() {
      return this.mealtimeType;
   }

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

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

   public String getMachineNum() {
      return this.machineNum;
   }

   public String getMachineName() {
      return this.machineName;
   }

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

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

   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 LocalDateTime getRefundTime() {
      return this.refundTime;
   }

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

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

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

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

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

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

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

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

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

   public OrderListMobileVO setMealtimeType(final String mealtimeType) {
      this.mealtimeType = mealtimeType;
      return this;
   }

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

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

   public OrderListMobileVO setMachineNum(final String machineNum) {
      this.machineNum = machineNum;
      return this;
   }

   public OrderListMobileVO setMachineName(final String machineName) {
      this.machineName = machineName;
      return this;
   }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   public OrderListMobileVO setRefundTime(final LocalDateTime refundTime) {
      this.refundTime = refundTime;
      return this;
   }

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

   public OrderListMobileVO setOrderDetailSum(final Integer orderDetailSum) {
      this.orderDetailSum = orderDetailSum;
      return this;
   }

   public OrderListMobileVO setOrderStateMixMobile(final Integer orderStateMixMobile) {
      this.orderStateMixMobile = orderStateMixMobile;
      return this;
   }

   public OrderListMobileVO setOrderDetailList(final List<OrderDetailMobileVO> orderDetailList) {
      this.orderDetailList = orderDetailList;
      return this;
   }
}
