package com.bonus.core.marketing.v2.rule.pay.handler.sequence.extension.impl;

import com.alibaba.fastjson.JSONObject;
import com.bonus.core.marketing.v2.rule.pay.dto.RulePayComputeDTO;
import com.bonus.core.marketing.v2.rule.pay.dto.RulePayResultDTO;
import com.bonus.core.marketing.v2.rule.pay.handler.sequence.dto.PaySequence;
import com.bonus.core.marketing.v2.rule.pay.handler.sequence.extension.PaySequenceHandlerExtension;
import com.bonus.core.marketing.vo.MarketRuleVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class DefaultPaySequenceHandlerExtension implements PaySequenceHandlerExtension {
   private static final Logger log = LoggerFactory.getLogger(DefaultPaySequenceHandlerExtension.class);

   @Override
   public RulePayResultDTO handle(RulePayComputeDTO computeDTO, MarketRuleVO rule) {
      PaySequence sequence = (PaySequence)JSONObject.parseObject(rule.getRuleInfo(), PaySequence.class);
      return (new RulePayResultDTO()).setWalletIds(sequence.getWalletIds());
   }
}
