using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Knot.Contracts.Settings.Application.Abstractions;
using Knot.Modules.Settings.Infrastructure.Configuration;

namespace Knot.Modules.Settings;

public static class DependencyInjection
{
    public static IServiceCollection AddSettingsModule(this IServiceCollection services, IConfiguration configuration)
    {
        services.AddSingleton<SettingsService>();
        
        services.AddSingleton<ISettingsService>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<ISystemSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IStoriesSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IChatsSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IMessagesSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IWebRtcSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IKlipySettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IImportSettings>(sp => sp.GetRequiredService<SettingsService>());
        services.AddSingleton<IFederationSettings>(sp => sp.GetRequiredService<SettingsService>());
        
        return services;
    }
}
