using Web.Api.Common;
using MediatR;

namespace Web.Api.Endpoints.Studio.Crew;

/// <summary>크루원 목록 조회</summary>
internal sealed class CrewMemberList : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        app.MapGet("api/studio/crew/member/list/{crewID}", async (
            int crewID,
            ISender sender,
            CancellationToken ct
        ) => {
            var data = await sender.Send(new Application.Features.Api.Crew.GetCrewMembers.Query(crewID), ct);
            return ApiResponse.Ok(data);
        })
        .WithTags("StudioCrew")
        .RequireAuthorization();
    }
}