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

import com.alibaba.fastjson.JSONObject;
import com.bonus.canteen.core.marketing.v2.rule.price.constants.RulePriceEnum;
import com.bonus.canteen.core.marketing.v2.rule.price.handler.RulePriceHandler;
import com.bonus.canteen.core.marketing.v2.rule.price.handler.limitsumamount.dto.PriceLimitSumAmountDTO;

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

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