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 AzureStorageFactoryExtensions
    {
        public static IServiceCollection AddAzureStorage(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<AzureStorageFactory>();
            services.Configure<AzureStorageFactoryOptions>(name, o => { o.Name = name; o.StorageAccountConnectionString = connectionString; });

            return services;
        }
    }
}
