using Application.Abstractions.Messaging;
using Web.Api.Common;

namespace Web.Api.Endpoints.Faq;

internal sealed class Categories : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        app.MapGet("api/faq/categories", async (
            ISender sender,
            CancellationToken ct
        ) => {
            return ApiResponse.Ok(
                await sender.Send(new Application.Features.Api.Faq.Category.GetActive.Query(), ct)
            );
        })
        .WithTags("Faq")
        .AllowAnonymous();
    }
}