package com.bonus.core.account.v3.po;

import cn.hutool.core.bean.BeanUtil;
import com.bonus.core.account.v3.constants.AccRechargeOperateEnum;
import com.bonus.core.account.v3.constants.AccRechargeSourceEnum;
import com.bonus.core.account.v3.constants.AccTradeStateEnum;
import com.bonus.core.account.v3.constants.AccTradeTypeEnum;
import com.bonus.core.account.v3.dto.AccWalletUpdateDTO;
import com.bonus.core.account.v3.web.vo.AccInfoVO;
import com.bonus.core.account.v3.web.vo.AccUpdateWalletBalanceVO;
import com.bonus.core.marketing.v2.rule.recharge.dto.RuleRechargeResultDTO;
import com.bonus.core.pay.common.constants.PayStateEnum;

import java.math.BigDecimal;
import java.time.LocalDateTime;

public class AccTradeAddPO {
   private LocalDateTime tradeTime;
   private Long custId;
   private Long orgId;
   private Integer psnType;
   private Integer tradeType;
   private BigDecimal actualAmount;
   private BigDecimal amount;
   private BigDecimal walletBalTotal;
   private BigDecimal accAllBal;
   private Integer payChannel;
   private Integer payType;
   private Integer payState;
   private Integer tradeState;
   private String thirdTradeNo;
   private String machineSn;
   private String batchNum;
   private Long leOrdNo;
   private Long originTradeId;
   private Long subTimeRuleId;
   private BigDecimal manageCost;
   private String crby;
   private String remark;
   private Integer withdrawSource;
   private Integer rechargeSource;
   private Long canteenId;
   private Integer machineType;
   private Integer rechargeOperate;
   private Boolean custPsnOrgBoolean;
   private Integer operateSource;
   private Long tradeId;
   private Long batchImportId;

   public static AccTradeAddPO builderWebWalletAccTradeV2(Long tradeId, AccInfoVO accInfoVO, RuleRechargeResultDTO ruleRechargeResultDTO, AccUpdateWalletBalanceVO accWalletBalance, String batchNum, AccRechargeOperateEnum rechargeOperateEnum, String remark, String userName) {
      return builder().tradeTime(LocalDateTime.now()).tradeId(tradeId).tradeType(AccTradeTypeEnum.RECHARGE.getKey()).custId(accInfoVO.getCustId()).psnType(accInfoVO.getPsnType()).orgId(accInfoVO.getOrgId()).actualAmount(ruleRechargeResultDTO.getActualAmount()).amount(ruleRechargeResultDTO.getAmount()).manageCost(ruleRechargeResultDTO.getManageCost()).walletBalTotal(accWalletBalance.getAccBalTotal()).accAllBal(accWalletBalance.getAccAllBal()).payChannel(ruleRechargeResultDTO.getPayChannel()).payType(ruleRechargeResultDTO.getPayType()).payState(PayStateEnum.PAY_SUCC.getKey()).tradeState(AccTradeStateEnum.TAKE_EFFECT.getKey()).rechargeSource(AccRechargeSourceEnum.WEB_YST.getKey()).batchNum(batchNum).rechargeOperate(rechargeOperateEnum.getKey()).remark(remark).crby(userName).build();
   }

   public static AccTradeAddPO assembleAccTradeAddPoV4(LocalDateTime tradeTime, AccWalletUpdateDTO updateWalletPo, AccUpdateWalletBalanceVO accUpdateWalletBalanceVO) {
      AccTradeAddPO accTradeAddPo = new AccTradeAddPO();
      BeanUtil.copyProperties(updateWalletPo, accTradeAddPo, new String[0]);
      accTradeAddPo.setTradeTime(tradeTime);
      accTradeAddPo.setAmount(updateWalletPo.getAmount());
      accTradeAddPo.setActualAmount(updateWalletPo.getAmount());
      accTradeAddPo.setWalletBalTotal(accUpdateWalletBalanceVO.getAccBalTotal());
      accTradeAddPo.setAccAllBal(accUpdateWalletBalanceVO.getAccAllBal());
      accTradeAddPo.setPayState(PayStateEnum.PAY_SUCC.getKey());
      accTradeAddPo.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey());
      return accTradeAddPo;
   }

   public static AccTradeAddPOBuilder builder() {
      return new AccTradeAddPOBuilder();
   }

   public LocalDateTime getTradeTime() {
      return this.tradeTime;
   }

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

   public Long getOrgId() {
      return this.orgId;
   }

   public Integer getPsnType() {
      return this.psnType;
   }

   public Integer getTradeType() {
      return this.tradeType;
   }

   public BigDecimal getActualAmount() {
      return this.actualAmount;
   }

   public BigDecimal getAmount() {
      return this.amount;
   }

   public BigDecimal getWalletBalTotal() {
      return this.walletBalTotal;
   }

   public BigDecimal getAccAllBal() {
      return this.accAllBal;
   }

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

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

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

   public Integer getTradeState() {
      return this.tradeState;
   }

   public String getThirdTradeNo() {
      return this.thirdTradeNo;
   }

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

   public String getBatchNum() {
      return this.batchNum;
   }

   public Long getLeOrdNo() {
      return this.leOrdNo;
   }

   public Long getOriginTradeId() {
      return this.originTradeId;
   }

   public Long getSubTimeRuleId() {
      return this.subTimeRuleId;
   }

   public BigDecimal getManageCost() {
      return this.manageCost;
   }

   public String getCrby() {
      return this.crby;
   }

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

   public Integer getWithdrawSource() {
      return this.withdrawSource;
   }

   public Integer getRechargeSource() {
      return this.rechargeSource;
   }

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

   public Integer getMachineType() {
      return this.machineType;
   }

   public Integer getRechargeOperate() {
      return this.rechargeOperate;
   }

   public Boolean getCustPsnOrgBoolean() {
      return this.custPsnOrgBoolean;
   }

   public Integer getOperateSource() {
      return this.operateSource;
   }

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

   public Long getBatchImportId() {
      return this.batchImportId;
   }

   public void setTradeTime(final LocalDateTime tradeTime) {
      this.tradeTime = tradeTime;
   }

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

   public void setOrgId(final Long orgId) {
      this.orgId = orgId;
   }

   public void setPsnType(final Integer psnType) {
      this.psnType = psnType;
   }

   public void setTradeType(final Integer tradeType) {
      this.tradeType = tradeType;
   }

   public void setActualAmount(final BigDecimal actualAmount) {
      this.actualAmount = actualAmount;
   }

   public void setAmount(final BigDecimal amount) {
      this.amount = amount;
   }

   public void setWalletBalTotal(final BigDecimal walletBalTotal) {
      this.walletBalTotal = walletBalTotal;
   }

   public void setAccAllBal(final BigDecimal accAllBal) {
      this.accAllBal = accAllBal;
   }

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

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

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

   public void setTradeState(final Integer tradeState) {
      this.tradeState = tradeState;
   }

   public void setThirdTradeNo(final String thirdTradeNo) {
      this.thirdTradeNo = thirdTradeNo;
   }

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

   public void setBatchNum(final String batchNum) {
      this.batchNum = batchNum;
   }

   public void setLeOrdNo(final Long leOrdNo) {
      this.leOrdNo = leOrdNo;
   }

   public void setOriginTradeId(final Long originTradeId) {
      this.originTradeId = originTradeId;
   }

   public void setSubTimeRuleId(final Long subTimeRuleId) {
      this.subTimeRuleId = subTimeRuleId;
   }

   public void setManageCost(final BigDecimal manageCost) {
      this.manageCost = manageCost;
   }

   public void setCrby(final String crby) {
      this.crby = crby;
   }

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

   public void setWithdrawSource(final Integer withdrawSource) {
      this.withdrawSource = withdrawSource;
   }

   public void setRechargeSource(final Integer rechargeSource) {
      this.rechargeSource = rechargeSource;
   }

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

   public void setMachineType(final Integer machineType) {
      this.machineType = machineType;
   }

   public void setRechargeOperate(final Integer rechargeOperate) {
      this.rechargeOperate = rechargeOperate;
   }

   public void setCustPsnOrgBoolean(final Boolean custPsnOrgBoolean) {
      this.custPsnOrgBoolean = custPsnOrgBoolean;
   }

   public void setOperateSource(final Integer operateSource) {
      this.operateSource = operateSource;
   }

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

   public void setBatchImportId(final Long batchImportId) {
      this.batchImportId = batchImportId;
   }


   public AccTradeAddPO(final LocalDateTime tradeTime, final Long custId, final Long orgId, final Integer psnType, final Integer tradeType, final BigDecimal actualAmount, final BigDecimal amount, final BigDecimal walletBalTotal, final BigDecimal accAllBal, final Integer payChannel, final Integer payType, final Integer payState, final Integer tradeState, final String thirdTradeNo, final String machineSn, final String batchNum, final Long leOrdNo, final Long originTradeId, final Long subTimeRuleId, final BigDecimal manageCost, final String crby, final String remark, final Integer withdrawSource, final Integer rechargeSource, final Long canteenId, final Integer machineType, final Integer rechargeOperate, final Boolean custPsnOrgBoolean, final Integer operateSource, final Long tradeId, final Long batchImportId) {
      this.tradeTime = tradeTime;
      this.custId = custId;
      this.orgId = orgId;
      this.psnType = psnType;
      this.tradeType = tradeType;
      this.actualAmount = actualAmount;
      this.amount = amount;
      this.walletBalTotal = walletBalTotal;
      this.accAllBal = accAllBal;
      this.payChannel = payChannel;
      this.payType = payType;
      this.payState = payState;
      this.tradeState = tradeState;
      this.thirdTradeNo = thirdTradeNo;
      this.machineSn = machineSn;
      this.batchNum = batchNum;
      this.leOrdNo = leOrdNo;
      this.originTradeId = originTradeId;
      this.subTimeRuleId = subTimeRuleId;
      this.manageCost = manageCost;
      this.crby = crby;
      this.remark = remark;
      this.withdrawSource = withdrawSource;
      this.rechargeSource = rechargeSource;
      this.canteenId = canteenId;
      this.machineType = machineType;
      this.rechargeOperate = rechargeOperate;
      this.custPsnOrgBoolean = custPsnOrgBoolean;
      this.operateSource = operateSource;
      this.tradeId = tradeId;
      this.batchImportId = batchImportId;
   }

   public AccTradeAddPO() {
   }

   public static class AccTradeAddPOBuilder {
      private LocalDateTime tradeTime;
      private Long custId;
      private Long orgId;
      private Integer psnType;
      private Integer tradeType;
      private BigDecimal actualAmount;
      private BigDecimal amount;
      private BigDecimal walletBalTotal;
      private BigDecimal accAllBal;
      private Integer payChannel;
      private Integer payType;
      private Integer payState;
      private Integer tradeState;
      private String thirdTradeNo;
      private String machineSn;
      private String batchNum;
      private Long leOrdNo;
      private Long originTradeId;
      private Long subTimeRuleId;
      private BigDecimal manageCost;
      private String crby;
      private String remark;
      private Integer withdrawSource;
      private Integer rechargeSource;
      private Long canteenId;
      private Integer machineType;
      private Integer rechargeOperate;
      private Boolean custPsnOrgBoolean;
      private Integer operateSource;
      private Long tradeId;
      private Long batchImportId;

      AccTradeAddPOBuilder() {
      }

      public AccTradeAddPOBuilder tradeTime(final LocalDateTime tradeTime) {
         this.tradeTime = tradeTime;
         return this;
      }

      public AccTradeAddPOBuilder custId(final Long custId) {
         this.custId = custId;
         return this;
      }

      public AccTradeAddPOBuilder orgId(final Long orgId) {
         this.orgId = orgId;
         return this;
      }

      public AccTradeAddPOBuilder psnType(final Integer psnType) {
         this.psnType = psnType;
         return this;
      }

      public AccTradeAddPOBuilder tradeType(final Integer tradeType) {
         this.tradeType = tradeType;
         return this;
      }

      public AccTradeAddPOBuilder actualAmount(final BigDecimal actualAmount) {
         this.actualAmount = actualAmount;
         return this;
      }

      public AccTradeAddPOBuilder amount(final BigDecimal amount) {
         this.amount = amount;
         return this;
      }

      public AccTradeAddPOBuilder walletBalTotal(final BigDecimal walletBalTotal) {
         this.walletBalTotal = walletBalTotal;
         return this;
      }

      public AccTradeAddPOBuilder accAllBal(final BigDecimal accAllBal) {
         this.accAllBal = accAllBal;
         return this;
      }

      public AccTradeAddPOBuilder payChannel(final Integer payChannel) {
         this.payChannel = payChannel;
         return this;
      }

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

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

      public AccTradeAddPOBuilder tradeState(final Integer tradeState) {
         this.tradeState = tradeState;
         return this;
      }

      public AccTradeAddPOBuilder thirdTradeNo(final String thirdTradeNo) {
         this.thirdTradeNo = thirdTradeNo;
         return this;
      }

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

      public AccTradeAddPOBuilder batchNum(final String batchNum) {
         this.batchNum = batchNum;
         return this;
      }

      public AccTradeAddPOBuilder leOrdNo(final Long leOrdNo) {
         this.leOrdNo = leOrdNo;
         return this;
      }

      public AccTradeAddPOBuilder originTradeId(final Long originTradeId) {
         this.originTradeId = originTradeId;
         return this;
      }

      public AccTradeAddPOBuilder subTimeRuleId(final Long subTimeRuleId) {
         this.subTimeRuleId = subTimeRuleId;
         return this;
      }

      public AccTradeAddPOBuilder manageCost(final BigDecimal manageCost) {
         this.manageCost = manageCost;
         return this;
      }

      public AccTradeAddPOBuilder crby(final String crby) {
         this.crby = crby;
         return this;
      }

      public AccTradeAddPOBuilder remark(final String remark) {
         this.remark = remark;
         return this;
      }

      public AccTradeAddPOBuilder withdrawSource(final Integer withdrawSource) {
         this.withdrawSource = withdrawSource;
         return this;
      }

      public AccTradeAddPOBuilder rechargeSource(final Integer rechargeSource) {
         this.rechargeSource = rechargeSource;
         return this;
      }

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

      public AccTradeAddPOBuilder machineType(final Integer machineType) {
         this.machineType = machineType;
         return this;
      }

      public AccTradeAddPOBuilder rechargeOperate(final Integer rechargeOperate) {
         this.rechargeOperate = rechargeOperate;
         return this;
      }

      public AccTradeAddPOBuilder custPsnOrgBoolean(final Boolean custPsnOrgBoolean) {
         this.custPsnOrgBoolean = custPsnOrgBoolean;
         return this;
      }

      public AccTradeAddPOBuilder operateSource(final Integer operateSource) {
         this.operateSource = operateSource;
         return this;
      }

      public AccTradeAddPOBuilder tradeId(final Long tradeId) {
         this.tradeId = tradeId;
         return this;
      }

      public AccTradeAddPOBuilder batchImportId(final Long batchImportId) {
         this.batchImportId = batchImportId;
         return this;
      }

      public AccTradeAddPO build() {
         return new AccTradeAddPO(this.tradeTime, this.custId, this.orgId, this.psnType, this.tradeType, this.actualAmount, this.amount, this.walletBalTotal, this.accAllBal, this.payChannel, this.payType, this.payState, this.tradeState, this.thirdTradeNo, this.machineSn, this.batchNum, this.leOrdNo, this.originTradeId, this.subTimeRuleId, this.manageCost, this.crby, this.remark, this.withdrawSource, this.rechargeSource, this.canteenId, this.machineType, this.rechargeOperate, this.custPsnOrgBoolean, this.operateSource, this.tradeId, this.batchImportId);
      }
   }
}
