using Microsoft.AspNetCore.Identity;
using Tiku.Application.Auth;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Domain.Identity;
using Tiku.Infrastructure.Persistence;

namespace Tiku.Infrastructure.Auth;

public sealed partial class AuthService(
    TikuDbContext dbContext,
    SignInManager<User> signInManager,
    UserManager<User> userManager,
    ISmsVerificationService smsVerificationService,
    IAuthSessionStore sessionStore,
    IWechatOAuthClient wechatOAuthClient,
    ITenantExternalProviderConfigService providerConfigService,
    IFeatureAccessService featureAccessService) : IAuthService
{
    private const string PasswordProvider = "password";
    private const string SmsProvider = "sms";
    private const string WechatWebProvider = "wechat_web";
    private const string WechatMiniAppProvider = "wechat_miniapp";
    private static readonly string[] WechatWebProviderAliases = ["wechat_web", "wechat-web", "wechat"];

    private static readonly string[] WechatMiniAppProviderAliases =
        ["wechat-miniapp", "wechat_miniapp", "wechat-mini", "wechatMiniapp"];

    private static readonly string[] WechatIdentityProviders =
        ["wechat_web", "wechat-web", "wechat", "wechat-miniapp", "wechat_miniapp", "wechat-mini", "wechatMiniapp"];
}