using Web.Api.Common;
using MediatR;

namespace Web.Api.Endpoints.Studio.Crew;

/// <summary>크루원 삭제</summary>
internal sealed class CrewMemberRemove : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        app.MapDelete("api/studio/crew/member/{crewMemberID}", async (
            int crewMemberID,
            ISender sender,
            CancellationToken ct
        ) => {
            await sender.Send(new Application.Features.Api.Crew.RemoveMember.Command(crewMemberID), ct);
            return ApiResponse.Ok();
        })
        .WithTags("StudioCrew")
        .RequireAuthorization();
    }
}