using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

/// <summary>
/// Stubs for central-only scoring and bundle endpoints — returns 503 during degraded mode.
/// </summary>
[ApiController]
[Route("api/v1/encounters/{encounterId:guid}")]
[Authorize]
public class CentralRequiredController : ControllerBase
{
    [HttpGet("news2")]
    public IActionResult News2History(Guid encounterId) =>
        CentralRequired("NEWS2 history requires central connection.");

    [HttpGet("news2/current")]
    public IActionResult News2Current(Guid encounterId) =>
        CentralRequired("NEWS2 current score requires central connection.");

    [HttpGet("qsofa/current")]
    public IActionResult QsofaCurrent(Guid encounterId) =>
        CentralRequired("qSOFA current score requires central connection.");

    [HttpGet("sofa/current")]
    public IActionResult SofaCurrent(Guid encounterId) =>
        CentralRequired("SOFA current score requires central connection.");

    [HttpGet("sepsis-bundle/current")]
    public IActionResult SepsisBundleCurrent(Guid encounterId) =>
        CentralRequired("Sepsis bundle status requires central connection.");

    private static IActionResult CentralRequired(string message) =>
        new ObjectResult(ApiResponse<object>.Fail(503, message, "CENTRAL_REQUIRED"))
        {
            StatusCode = StatusCodes.Status503ServiceUnavailable
        };
}
