package com.bonus.core.marketing.v2.rule.meal.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class RuleMealProvider {
   @Autowired
   private List<RuleMealHandler> ruleMealHandlers;

   public RuleMealHandler getMarketMealHandler(Integer ruleType) {
      return (RuleMealHandler)this.ruleMealHandlers.stream().filter((e) -> {
         return Objects.equals(ruleType, e.getRuleType());
      }).findFirst().orElse(null);
   }
}
