using Web.Api.Common;
using MediatR;

namespace Web.Api.Endpoints.Studio.Crew;

/// <summary>크루 초대 코드 생성</summary>
internal sealed class CrewInviteCode : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        app.MapPost("api/studio/crew/invite/generate", async (
            Application.Features.Api.Crew.GenerateInviteCode.Command body,
            ISender sender,
            CancellationToken ct
        ) => {
            var data = await sender.Send(body, ct);
            return ApiResponse.Ok(data);
        })
        .WithTags("StudioCrew")
        .RequireAuthorization();
    }
}