using Web.Api.Common;
using MediatR;

namespace Web.Api.Endpoints.Donation;

/// <summary>리모콘 — 재전송</summary>
internal sealed class RemoteResend : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        /// 실패/무시된 알림을 대기열 맨 뒤에 재추가 (Queued로 초기화)
        app.MapPost("api/donation/remote/resend/{alertID}", async (
            int alertID,
            ISender sender,
            CancellationToken ct
        ) => {
            await sender.Send(new Application.Features.Api.DonationRemote.ResendAlert.Command(alertID), ct);

            return ApiResponse.Ok();
        })
        .WithTags("DonationRemote")
        .RequireAuthorization();
    }
}