using Indotalent.Infrastructure.Authentication;
using Indotalent.Infrastructure.Authentication.Identity;
using Indotalent.Infrastructure.AutoNumberGenerator;
using Indotalent.Infrastructure.BackgroundJob;
using Indotalent.Infrastructure.Database;
using Indotalent.Infrastructure.Email;
using Indotalent.Infrastructure.File;
using Indotalent.Infrastructure.Logging;
using Indotalent.Infrastructure.OData;

namespace Indotalent.Infrastructure;

public static class DI
{
    public static IServiceCollection AddInfrastructureDI(this IServiceCollection services, IConfiguration configuration)
    {
        services.Configure<DatabaseSettingsModel>(configuration.GetSection("DatabaseSettings"));
        services.Configure<BackgroundJobSettingsModel>(configuration.GetSection("BackgroundJobSettings"));
        services.Configure<EmailSettingsModel>(configuration.GetSection("EmailSettings"));
        services.Configure<FileStorageSettingsModel>(configuration.GetSection("FileStorageSettings"));
        services.Configure<LoggerSettingsModel>(configuration.GetSection("LoggerSettings"));
        services.Configure<IdentitySettingsModel>(configuration.GetSection("IdentitySettings"));

        services.AddLoggingService();

        services.AddDatabaseService(configuration);

        services.AddBackgroundJobService();

        services.AddEmailService(configuration);

        services.AddFileService();

        services.AddAuthenticationService(configuration);

        services.AddAutoNumberGeneratorService();

        services.AddODataService();


        return services;
    }
}