using Tiku.Application.Auth;

namespace Tiku.Infrastructure.Auth;

public sealed partial class AuthService
{
    public Task<AuthenticationResult> LoginWithWechatWebAsync(
        WechatLoginRequest request,
        CancellationToken cancellationToken = default)
    {
        return LoginWithWechatAsync(
            request,
            WechatWebProvider,
            WechatWebProviderAliases,
            (options, code, token) => wechatOAuthClient.ExchangeWebCodeAsync(options, code, token),
            cancellationToken);
    }

    public Task<AuthenticationResult> LoginWithWechatMiniAppAsync(
        WechatLoginRequest request,
        CancellationToken cancellationToken = default)
    {
        return LoginWithWechatAsync(
            request,
            WechatMiniAppProvider,
            WechatMiniAppProviderAliases,
            (options, code, token) => wechatOAuthClient.ExchangeMiniAppCodeAsync(options, code, token),
            cancellationToken);
    }
}