{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.gov.pk/kissan/schemas/live-session.schema.json",
  "title": "Live Consultation Session",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "session_id",
    "case_id",
    "room_id",
    "state",
    "media_mode",
    "created_at",
    "consent_version"
  ],
  "properties": {
    "session_id": {
      "type": "string",
      "pattern": "^LIVE-[A-Z0-9-]+$"
    },
    "case_id": {
      "type": "string",
      "pattern": "^CASE-[A-Z0-9-]+$"
    },
    "room_id": {
      "type": "string"
    },
    "state": {
      "enum": [
        "CREATED",
        "CONNECTING",
        "LIVE",
        "DEGRADED",
        "ENDED",
        "FAILED"
      ]
    },
    "media_mode": {
      "enum": [
        "FULL_VIDEO",
        "REDUCED_VIDEO",
        "AUDIO_WITH_STILLS",
        "PUSH_TO_TALK",
        "QUEUED_CASE"
      ]
    },
    "participant_mode": {
      "enum": [
        "AI_ONLY",
        "OFFICER_JOIN_REQUESTED",
        "OFFICER_JOINED",
        "WARM_HANDOFF"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "ended_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "consent_version": {
      "type": "string"
    },
    "recording_enabled": {
      "type": "boolean",
      "default": false
    },
    "audio_track_active": {
      "type": "boolean"
    },
    "video_track_active": {
      "type": "boolean"
    },
    "network_quality": {
      "enum": [
        "UNKNOWN",
        "EXCELLENT",
        "GOOD",
        "POOR",
        "LOST"
      ]
    },
    "selected_frame_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "officer_participant_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "media_policy_version": {
      "type": "string"
    }
  }
}