package com.bonus.canteen.core.pay.api.vo;

import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.order.common.model.OrderInfo;
import com.bonus.canteen.core.order.utils.LeNumUtil;
import com.bonus.canteen.core.pay.api.dto.UnifyPayDTO;
import com.bonus.canteen.core.pay.common.model.TradeRecord;

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

public class TradeRecordParamVO {
   private Long tradeId;
   private Long custId;
   private String custName;
   private Long canteenId;
   private String canteenName;
   private Long stallId;
   private String stallName;
   private String mchNum;
   private String mchName;
   private String mchSn;
   private LocalDateTime orderTime;
   private Integer nuClearMode;
   private Integer ifOnline;
   private String remark;
   private Integer sourceType;
   private Integer orderType;
   private List<UnifyPayDTO.Order> orderList = CollUtil.newArrayList(new UnifyPayDTO.Order[0]);

   public void fillOrderInfoList(List<OrderInfo> orderList) {
      if (!CollUtil.isEmpty(orderList)) {
         this.orderList = (List)orderList.stream().map(UnifyPayDTO.Order::of).collect(Collectors.toList());
         this.custId = (Long) LeNumUtil.reduceField(orderList, OrderInfo::getCustId, (Object)null);
         this.canteenId = (Long)LeNumUtil.reduceField(orderList, OrderInfo::getCanteenId, (Object)null);
         this.canteenName = (String)LeNumUtil.reduceField(orderList, OrderInfo::getCanteenName, (Object)null);
         this.stallId = (Long)LeNumUtil.reduceField(orderList, OrderInfo::getStallId, (Object)null);
         this.stallName = (String)LeNumUtil.reduceField(orderList, OrderInfo::getStallName, (Object)null);
         this.mchNum = (String)LeNumUtil.reduceField(orderList, OrderInfo::getMachineNum, (Object)null);
         this.mchSn = (String)LeNumUtil.reduceField(orderList, OrderInfo::getMachineSn, (Object)null);
         this.orderTime = (LocalDateTime)LeNumUtil.reduceField(orderList, OrderInfo::getOrderTime, (Object)null);
         this.nuClearMode = (Integer)LeNumUtil.reduceField(orderList, OrderInfo::getNuClearMode, (Object)null);
         this.ifOnline = (Integer)LeNumUtil.reduceField(orderList, OrderInfo::getIfOnline, (Object)null);
         this.remark = (String)LeNumUtil.reduceField(orderList, OrderInfo::getRemark, (Object)null);
         this.orderType = (Integer)LeNumUtil.reduceField(orderList, OrderInfo::getOrderType, (Object)null);
         this.sourceType = (Integer)LeNumUtil.reduceField(orderList, OrderInfo::getSourceType, (Object)null);
      }
   }

   public static TradeRecordParamVO of(TradeRecord tradeRecord) {
      TradeRecordParamVO tradeRecordParamVO = new TradeRecordParamVO();
      tradeRecordParamVO.setTradeId(tradeRecord.getId());
      tradeRecordParamVO.setCanteenId(tradeRecord.getCanteenId());
      tradeRecordParamVO.setCustId(tradeRecord.getCustId());
      tradeRecordParamVO.setSourceType(tradeRecord.getSourceType());
      return tradeRecordParamVO;
   }

   public Long getTradeId() {
      return this.tradeId;
   }

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

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

   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 getMchNum() {
      return this.mchNum;
   }

   public String getMchName() {
      return this.mchName;
   }

   public String getMchSn() {
      return this.mchSn;
   }

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

   public Integer getNuClearMode() {
      return this.nuClearMode;
   }

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

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

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

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

   public List<UnifyPayDTO.Order> getOrderList() {
      return this.orderList;
   }

   public void setTradeId(final Long tradeId) {
      this.tradeId = tradeId;
   }

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

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

   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 setMchNum(final String mchNum) {
      this.mchNum = mchNum;
   }

   public void setMchName(final String mchName) {
      this.mchName = mchName;
   }

   public void setMchSn(final String mchSn) {
      this.mchSn = mchSn;
   }

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

   public void setNuClearMode(final Integer nuClearMode) {
      this.nuClearMode = nuClearMode;
   }

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

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

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

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

   public void setOrderList(final List<UnifyPayDTO.Order> orderList) {
      this.orderList = orderList;
   }

}
