using adas_core.Authentication.Interfaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace adas_core.LdapLogin.Configuration;

/// <summary>
/// Module for configuring LDAP services and dependencies.
/// </summary>
public class LdapModule : IModule
{
    /// <summary>
    /// Configures LDAP services and dependencies.
    /// </summary>
    /// <param name="services">The service collection to which LDAP services will be added.</param>
    /// <param name="configuration">The configuration from which LDAP settings will be read.</param>
    public static void Configure(IServiceCollection services, IConfiguration configuration)
    {
        var configSection = configuration.GetSection("Ldap");
        services.Configure<LdapConfig>(configSection);
        services.AddScoped<ILoginService, LdapLoginService>();
    }
}