using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SCM.Application.Medicao;
using SCM.Shared.Api;
using SCM.Shared.Constants;
namespace SCM.Api.Controllers;
/// Faturamento físico-financeiro por EAP (read-model JSON; tipos F/P/J; PDF adiado).
[ApiController]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}")]
[Authorize]
[Produces("application/json")]
public sealed class FaturamentosController : ControllerBase
{
private readonly IFaturamentoService _service;
public FaturamentosController(IFaturamentoService service) => _service = service;
/// Relatório de faturamento do contrato: valor previsto e apropriado por EAP×item.
[HttpGet("contratos/{contratoId:guid}/faturamento")]
[Authorize(Roles = Roles.Administrador + "," + Roles.Gestor + "," + Roles.Engenheiro)]
[ProducesResponseType(typeof(FaturamentoResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status404NotFound)]
public async Task> GetFaturamento(
Guid contratoId, CancellationToken ct = default)
=> Ok(await _service.GetFaturamentoAsync(contratoId, ct));
}