package com.bonus.core.marketing.v2.rule.price.handler.sumgive.dto;

import com.bonus.core.account.v3.metadata.enums.AccWalletIdEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@ApiModel("计价规则详情-满额赠送")
public class PriceSumGiveDTO {
   @ApiModelProperty("阶梯信息")
   private List<PriceSumGiveItem> items;

   public String toString() {
      StringBuilder stringBuilder = new StringBuilder();
      AtomicInteger index = new AtomicInteger(1);
      this.items.forEach((e) -> {
         stringBuilder.append("阶梯").append(index.get()).append("，").append("，门槛金额：").append(e.getDoorAmount().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)).append("，赠送金额：").append(e.getGiveAmount().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)).append("，赠送钱包：").append(AccWalletIdEnum.getDesc(e.getWalletId())).append("<br/>");
         index.getAndIncrement();
      });
      return stringBuilder.toString();
   }

   public List<PriceSumGiveItem> getItems() {
      return this.items;
   }

   public void setItems(final List<PriceSumGiveItem> items) {
      this.items = items;
   }

}
