package org.jpos.tcpay.connection;


import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class AcquirerChannelFactory {

    private static Map<String, AcquirerChannel> mappers = new ConcurrentHashMap<>();

    public static  AcquirerChannel getAcquirerChannel(String acqName) {
        if (mappers.containsKey(acqName)) {
            return mappers.get(acqName);
        }

        switch (acqName) {
            case "Fiserv": {
                FiservChannel channel = new FiservChannel();
                mappers.put(acqName, channel);
                return channel;
            }

            case "YSP": {
                YspChannel channel = new YspChannel();
                mappers.put(acqName, channel);
                return channel;
            }

            case "Simulator": {
                BaseChannel channel = new BaseChannel();
                mappers.put(acqName, channel);
                return channel;
            }
            default:
                return null;
        }
    }
}
