using Web.Api.Common;
using MediatR;

namespace Web.Api.Endpoints.Donation;

/// <summary>리모콘 — 건너뛰기</summary>
internal sealed class RemoteSkip : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        /// 현재 재생 중인 알림 즉시 종료 → 다음 알림으로 넘김
        app.MapPost("api/donation/remote/skip/{widgetToken}", async (
            string widgetToken,
            ISender sender,
            CancellationToken ct
        ) => {
            await sender.Send(new Application.Features.Api.DonationRemote.SkipCurrent.Command(widgetToken), ct);

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