using System.ComponentModel.DataAnnotations;
using Asp.Versioning;
using Baya.Application.Features.PartnerCenters.Queries.GetCenterDashboard;
using Baya.Application.Models.PartnerCenters;
using Baya.WebFramework.Attributes;
using Baya.WebFramework.BaseController;
using Mediator;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Baya.Web.Api.Controllers.V1;

/// <summary>The partner-center portal — scoped to the center's own dashboard account (or staff). Surfaces the
/// sponsored nurses + booking/invoice counts + the masked settlement summary.</summary>
[ApiVersion("1")]
[ApiController]
[Route("api/v{version:apiVersion}/centers")]
[Authorize]
[Display(Description = "Partner-center dashboard (center account scoped)")]
public sealed class CentersController(ISender sender) : BaseController
{
    [HttpGet("{id}/dashboard")]
    [ProducesOkApiResponseType<CenterDashboardDto>]
    public async Task<IActionResult> Dashboard(long id, CancellationToken cancellationToken)
        => OperationResult(await sender.Send(new GetCenterDashboardQuery(id), cancellationToken));
}
