using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Modules.User.Application;
using Modules.User.Database;
using Modules.Media.Api;

namespace Modules.User.Api;

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddAccount(this IServiceCollection services, IConfigurationManager configuration,
        string jwtSettingsSection, string? connectionString, string fileStorageSettingsSection)
    {
        if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException(nameof(connectionString));
        services.AddDatabase(connectionString);
        services.AddTokens(configuration, jwtSettingsSection);
        services.AddMediaStorage(configuration, fileStorageSettingsSection);
        return services;
    }
}