package cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.trigger;

import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.trigger.PaymentTriggerService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RequiredArgsConstructor
public class PaymentTriggerServiceFactory {
    private final Map<String, PaymentTriggerService> paymentTriggerServiceMap;

    public enum PTriggerPaySe {
        kko,
        nv,
    }

    public PaymentTriggerService getService(PTriggerPaySe PTriggerPaySe) {
        String beanName = PTriggerPaySe.name() + "PaymentTriggerService";
        if (paymentTriggerServiceMap.containsKey(beanName))
            return paymentTriggerServiceMap.get(beanName);
        else
            throw new EnsException(EnsErrCd.NOT_FOUND_BEAN, EnsErrCd.NOT_FOUND_BEAN.getCodeNm());
    }
}
