using Microsoft.AspNetCore.Mvc; [ApiController] [Route("api/v1/encounters/{encounterId:guid}/gcs")] [Produces("application/json")] public class GcsController : ControllerBase { private readonly IGcsService _gcs; public GcsController(IGcsService gcs) => _gcs = gcs; [HttpGet] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status404NotFound)] public async Task Current(Guid encounterId) { var score = await _gcs.GetCurrentAsync(encounterId); if (score is null) return NotFound(ApiResponse.Fail( 404, "No GCS score computed for this encounter.", "NO_GCS_SCORE")); return Ok(ApiResponse.Ok(new GcsScoreResponse( score.EyeScore, score.VerbalScore, score.MotorScore, score.TotalScore, score.Classification, score.CalculatedAt))); } }