package com.bonus.core.marketing.v2.rule.recharge.handler.sumamount.extension;

import com.alibaba.fastjson.JSONObject;
import com.bonus.core.common.utils.JavaxValidateUtils;
import com.bonus.core.marketing.v2.rule.recharge.constants.RuleRechargeEnum;
import com.bonus.core.marketing.v2.rule.recharge.handler.RuleRechargeHandler;
import com.bonus.core.marketing.v2.rule.recharge.handler.sumamount.dto.RechargeSumAmountDTO;

public interface RechargeSumAmountHandlerExtension extends RuleRechargeHandler {
   @Override
   default Integer getRuleType() {
      return RuleRechargeEnum.RULE_SUM_AMOUNT.getKey();
   }

   @Override
   default void checkRuleInfo(String ruleInfo) {
      RechargeSumAmountDTO sumAmountDTO = (RechargeSumAmountDTO)JSONObject.parseObject(ruleInfo, RechargeSumAmountDTO.class);
      JavaxValidateUtils.validate(sumAmountDTO);
   }
}
