{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/advisor-evidence.schema.json",
  "title": "OMS protected dispatch advisor evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "dispatch_intent_sha256",
    "verdict",
    "summary",
    "recommendations",
    "risks",
    "provider_request_id",
    "fresh_session_id",
    "contact_reference",
    "advice_authorization_id"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "dispatch_intent_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "verdict": { "enum": ["approve", "revise", "veto"] },
    "summary": { "type": "string", "minLength": 1, "maxLength": 8192 },
    "recommendations": {
      "type": "array",
      "maxItems": 64,
      "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
    },
    "risks": {
      "type": "array",
      "maxItems": 64,
      "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
    },
    "provider_request_id": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    },
    "fresh_session_id": { "type": "string", "minLength": 1, "maxLength": 128 },
    "contact_reference": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contact_id", "sha256", "file_name"],
      "properties": {
        "contact_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "file_name": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9.-]{0,132}[a-z0-9])?\\.json$" }
      }
    },
    "advice_authorization_id": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    }
  }
}
