package com.bonus.core.marketing.v2.rule.recharge.dto;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.bonus.core.account.v3.constants.AccTradeTypeEnum;
import com.bonus.core.account.v3.metadata.enums.AccWalletIdEnum;
import com.bonus.core.marketing.v2.model.MarketRuleRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@ApiModel("充值规则出参")
public class RuleRechargeResultDTO extends RuleRechargeComputeDTO {
   @ApiModelProperty("实际充值金额")
   private BigDecimal actualAmount;
   @ApiModelProperty("管理费")
   private BigDecimal manageCost;
   @ApiModelProperty("钱包发生金额详情")
   private List<RuleRechargeWalletDTO> walletDetails;
   @ApiModelProperty("命中消费规则记录")
   private List<MarketRuleRecord> ruleRecord;

   public RuleRechargeResultDTO(RuleRechargeComputeDTO computeDTO) {
      BeanUtil.copyProperties(computeDTO, this, new String[0]);
      this.actualAmount = computeDTO.getAmount();
      this.manageCost = BigDecimal.ZERO;
      this.walletDetails = CollUtil.newArrayList(new RuleRechargeWalletDTO[]{(new RuleRechargeWalletDTO()).setWalletId(AccWalletIdEnum.WALLET.getKey()).setAmount(computeDTO.getAmount()).setTradeType(AccTradeTypeEnum.RECHARGE.getKey())});
      this.ruleRecord = new ArrayList();
   }

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

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

   public List<RuleRechargeWalletDTO> getWalletDetails() {
      return this.walletDetails;
   }

   public List<MarketRuleRecord> getRuleRecord() {
      return this.ruleRecord;
   }

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

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

   public RuleRechargeResultDTO setWalletDetails(final List<RuleRechargeWalletDTO> walletDetails) {
      this.walletDetails = walletDetails;
      return this;
   }

   public RuleRechargeResultDTO setRuleRecord(final List<MarketRuleRecord> ruleRecord) {
      this.ruleRecord = ruleRecord;
      return this;
   }


   public RuleRechargeResultDTO(final BigDecimal actualAmount, final BigDecimal manageCost, final List<RuleRechargeWalletDTO> walletDetails, final List<MarketRuleRecord> ruleRecord) {
      this.actualAmount = actualAmount;
      this.manageCost = manageCost;
      this.walletDetails = walletDetails;
      this.ruleRecord = ruleRecord;
   }

   public RuleRechargeResultDTO() {
   }
}
