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

namespace adas_core.Authentication.RegistrationExtensions;

/// <summary>
/// Provides static functionality related to user authentication registration processes.
/// </summary>
/// <remarks>
/// This static class serves as a container for registration-related authentication operations.
/// </remarks>
public static class AuthRegistration
{
    /// <summary>
    /// Registers authentication-related services in the dependency injection container, including a singleton <see cref="IUserService"/> and a lazy wrapper for deferred resolution.
    /// </summary>
    /// <param name="serviceCollection">The service collection to which the authentication services are added.</param>
    public static void AddAuth(this IServiceCollection serviceCollection)
        {
            serviceCollection.AddSingleton<IUserService, UserService>();
            serviceCollection.AddSingleton<Lazy<IUserService>>(provider =>
                new Lazy<IUserService>(provider.GetRequiredService<IUserService>));
        }
}