using BBWYB.Common.Http;

namespace SDKAdapter.OperationPlatform.Client
{
    public class OP_PlatformClientFactory
    {
        private IList<OP_PlatformClient> clients;

        public OP_PlatformClientFactory(RestApiService restApiService)
        {
            clients = new List<OP_PlatformClient>();
            clients.Add(new OP_JDClient(restApiService));
            clients.Add(new OP_QuanTanClient(restApiService));
        }

        public OP_PlatformClient GetClient(AdapterEnums.PlatformType platform)
        {
            var client = clients.FirstOrDefault(c => c.Platform == platform);
            if (client == null)
                throw new Exception("不支持的平台");
            return client;
        }
    }
}