namespace Brizco.Api.Controllers;

public class PageController : ICarterModule
{

    public void AddRoutes(IEndpointRouteBuilder app)
    {

        var group = app.NewVersionedApi("Page")
            .MapGroup($"api/page")
            .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());

        group.MapGet("/dashboard/app", GetAppDashboardAsync)
            .WithDisplayName("GetAppDashboard")
            .HasApiVersion(1.0);

    }

    public async Task<IResult> GetAppDashboardAsync([FromServices] IPageService pageService, CancellationToken cancellationToken)
        => TypedResults.Ok(await pageService.GetAppDashboardAsync(cancellationToken));
}