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>
/// <!-- aidoc:v1 sig=4b93bc4 -->
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>
    /// <!-- aidoc:v1 sig=a0a5f7c body=020607b -->
    public static void Configure(IServiceCollection services, IConfiguration configuration)
    {
        var configSection = configuration.GetSection("Ldap");
        services.Configure<LdapConfig>(configSection);
        services.AddScoped<ILoginService, LdapLoginService>();
    }
}