using FastEndpoints;

namespace SpaceGame.Api.Auth.Api;

public sealed class ForgotPasswordHandler(AuthService authService) : Endpoint<ForgotPasswordRequest, ForgotPasswordResponse>
{
    public override void Configure()
    {
        Post("/api/auth/forgot-password");
        AllowAnonymous();
    }

    public override async Task HandleAsync(ForgotPasswordRequest request, CancellationToken cancellationToken)
    {
        await SendOkAsync(await authService.ForgotPasswordAsync(request, cancellationToken), cancellationToken);
    }
}
