using Microsoft.Extensions.DependencyInjection;
using TakeoutSaaS.Application.Identity.Abstractions;
using TakeoutSaaS.Application.Identity.Services;

namespace TakeoutSaaS.Application.Identity.Extensions;

/// <summary>
/// 应用层身份认证服务注入
/// </summary>
public static class IdentityServiceCollectionExtensions
{
    /// <summary>
    /// 注册身份认证相关应用服务
    /// </summary>
    /// <param name="services">服务集合</param>
    /// <param name="enableMiniSupport">是否注册小程序认证服务</param>
    public static IServiceCollection AddIdentityApplication(this IServiceCollection services, bool enableMiniSupport = false)
    {
        services.AddScoped<IAdminAuthService, AdminAuthService>();

        if (enableMiniSupport)
        {
            services.AddScoped<IMiniAuthService, MiniAuthService>();
        }

        return services;
    }
}
