{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.gov.pk/kissan/schemas/case-state.schema.json",
  "title": "Agriculture Case State",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "case_id",
    "session_id",
    "status",
    "language",
    "created_at",
    "evidence_ids",
    "risk_class"
  ],
  "properties": {
    "case_id": {
      "type": "string",
      "pattern": "^CASE-[A-Z0-9-]+$"
    },
    "farmer_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "session_id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "OPEN",
        "COLLECTING_EVIDENCE",
        "ANALYSING",
        "RESEARCHING",
        "AWAITING_REVIEW",
        "ANSWERED",
        "CLOSED"
      ]
    },
    "language": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "crop_context": {
      "type": "object",
      "additionalProperties": true
    },
    "location_context": {
      "type": "object",
      "additionalProperties": true
    },
    "original_transcript": {
      "type": [
        "string",
        "null"
      ]
    },
    "normalized_transcript": {
      "type": [
        "string",
        "null"
      ]
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "evidence_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "hypotheses": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "missing_information": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "risk_class": {
      "enum": [
        "LOW",
        "MEDIUM",
        "HIGH",
        "CRITICAL"
      ]
    },
    "research_state": {
      "type": "object"
    },
    "policy_result_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "escalation_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "approved_response_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "workflow_version": {
      "type": "string"
    },
    "live_session_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    }
  }
}