using MediatR;
using Web.Api.Common;

namespace Web.Api.Endpoints.Config;

internal sealed class Config : IEndpoint
{
    public void MapEndpoint(IEndpointRouteBuilder app)
    {
        app.MapGet("api/config", async (
            ISender sender,
            CancellationToken ct
        ) => {
            var result = await sender.Send(new Application.Features.Config.Get.Query(), ct);

            return ApiResponse.Ok(result);
        })
        .WithTags("Config")
        .AllowAnonymous();
    }
}