package com.bonus.core.marketing.v2.rule.price.handler.deductionratio.extension;

import com.alibaba.fastjson.JSONObject;
import com.bonus.core.marketing.v2.rule.price.constants.RulePriceEnum;
import com.bonus.core.marketing.v2.rule.price.handler.RulePriceHandler;
import com.bonus.core.marketing.v2.rule.price.handler.deductionratio.dto.PriceDeductionRatioDTO;

public interface PriceDeductionRatioHandlerExtension extends RulePriceHandler {
   default Integer getRuleType() {
      return RulePriceEnum.RULE_DEDUCTION_RATIO.getKey();
   }

   default String checkRuleInfo(String ruleInfo) {
      PriceDeductionRatioDTO rule = (PriceDeductionRatioDTO)JSONObject.parseObject(ruleInfo, PriceDeductionRatioDTO.class);
      return rule.toString();
   }
}
