package com.bonus.core.marketing.vo;

import cn.hutool.core.bean.BeanUtil;
import com.bonus.core.marketing.util.EnumUtil;
import com.bonus.core.marketing.v2.model.MarketRuleRecord;
import com.bonus.core.marketing.v2.rule.price.constants.RulePriceEnum;
import com.bonus.core.marketing.v2.rule.price.dto.RulePriceResultOrderDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("规则使用记录VO")
public class MarketRuleRecordVO extends MarketRuleRecord {
   @ApiModelProperty("消费规则类型")
   private Integer ruleType;
   @ApiModelProperty("消费规则类型文本")
   private String ruleTypeText;

   public MarketRuleRecordVO(RulePriceResultOrderDTO resultOrder, MarketRuleVO ruleInfo, Long recordId) {
      MarketRuleRecord marketRuleRecord = new MarketRuleRecord(resultOrder, ruleInfo, recordId);
      BeanUtil.copyProperties(marketRuleRecord, this, new String[0]);
      RulePriceEnum priceEnum = (RulePriceEnum) EnumUtil.getEnumByKey(RulePriceEnum.class, ruleInfo.getRuleType());
      this.ruleType = ruleInfo.getRuleType();
      this.ruleTypeText = priceEnum.getValue();
   }

   public Integer getRuleType() {
      return this.ruleType;
   }

   public String getRuleTypeText() {
      return this.ruleTypeText;
   }

   public void setRuleType(final Integer ruleType) {
      this.ruleType = ruleType;
   }

   public void setRuleTypeText(final String ruleTypeText) {
      this.ruleTypeText = ruleTypeText;
   }

   public MarketRuleRecordVO(final Integer ruleType, final String ruleTypeText) {
      this.ruleType = ruleType;
      this.ruleTypeText = ruleTypeText;
   }

   public MarketRuleRecordVO() {
   }
}
