using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Text;

namespace TEAMModelOS.SDK.DI
{
    public static class AzureCosmosFactoryExtensions
    {
        public static IServiceCollection AddAzureCosmos(this IServiceCollection services, string connectionString, string name = "Default")
        {
            if (services == null) throw new ArgumentNullException(nameof(services));
            if (connectionString == null) throw new ArgumentNullException(nameof(connectionString));
            services.TryAddSingleton<AzureCosmosFactory>();
            services.Configure<AzureCosmosFactoryOptions>(name, o => { o.Name = name; o.CosmosConnectionString = connectionString; });
            return services;
        }
    }
}
