using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
///
/// Track B live capture endpoints for credentialed clinicians.
/// Observations entered via these endpoints skip the verification queue
/// and are promoted synchronously to VigilCareClinical with full
/// critical value alerting.
///
[ApiController]
[Route("api/v1/live-capture")]
[Produces("application/json")]
[Authorize(Roles = "CLINICIAN")]
public class LiveCaptureController : ControllerBase
{
private readonly ILiveCaptureService _liveCapture;
public LiveCaptureController(ILiveCaptureService liveCapture) =>
_liveCapture = liveCapture;
///
/// Records observations against an existing VigilCareClinical encounter.
/// Requires clinician attestation and password re-confirmation.
/// Returns promoted observation IDs and any synchronous critical alerts.
///
///
/// Track B workflow: no verification queue. Clinician attestation replaces
/// the dual-human gate used in Track A (backfill). Each observation is
/// promoted immediately and evaluated against critical alert thresholds
/// before this response returns.
///
/// Critical alerts are generated synchronously — a critical potassium
/// value will have an open ClinicalAlert row in the database before
/// the 201 response reaches the clinician's tablet.
///
[HttpPost("encounters/{encounterId:guid}/observations")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status201Created)]
[ProducesResponseType(typeof(ApiResponse