{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://analysisreports.github.io/schemas/nexus.schema.json",
  "title": "LLMS Cognitive Nexus Engine Schema",
  "description": "Formal JSON Schema Draft 2020-12 data contract for deterministic Claims-vs-Reality cognitive nexus nodes.",
  "type": "object",
  "required": [
    "metadata",
    "cognitive_nodes"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "required": [
        "title",
        "domain",
        "version",
        "author",
        "license",
        "endpoint",
        "text_endpoint",
        "documentation",
        "last_updated",
        "sync_status",
        "active_nodes_count",
        "total_nodes_count"
      ],
      "properties": {
        "title": { "type": "string" },
        "domain": { "type": "string" },
        "version": { "type": "string" },
        "author": { "type": "string" },
        "license": { "type": "string" },
        "endpoint": { "type": "string", "format": "uri" },
        "text_endpoint": { "type": "string", "format": "uri" },
        "documentation": { "type": "string", "format": "uri" },
        "last_updated": { "type": "string", "format": "date-time" },
        "sync_status": {
          "type": "string",
          "enum": ["SUCCESS", "PARTIAL", "FAILED"]
        },
        "active_nodes_count": { "type": "integer", "minimum": 0 },
        "total_nodes_count": { "type": "integer", "minimum": 0 }
      },
      "additionalProperties": true
    },
    "cognitive_nodes": {
      "type": "object",
      "patternProperties": {
        "^NEXUS_[0-9]{2}$": {
          "type": "object",
          "required": [
            "nexus_id",
            "title",
            "status",
            "trigger_logic",
            "evaluated_inputs",
            "market_claim_illusion",
            "quantitative_reality",
            "causal_chain",
            "systemic_impact",
            "historical_precedents"
          ],
          "properties": {
            "nexus_id": {
              "type": "string",
              "pattern": "^NEXUS_[0-9]{2}$"
            },
            "title": { "type": "string" },
            "status": {
              "type": "string",
              "enum": ["ACTIVE", "INACTIVE", "SOURCE_FEED_UNAVAILABLE"]
            },
            "trigger_logic": { "type": "string" },
            "evaluated_inputs": {
              "type": "object",
              "additionalProperties": {
                "type": ["number", "string", "null"]
              }
            },
            "market_claim_illusion": { "type": ["string", "null"] },
            "quantitative_reality": { "type": ["string", "null"] },
            "causal_chain": { "type": ["string", "null"] },
            "systemic_impact": { "type": ["string", "null"] },
            "historical_precedents": {
              "type": "array",
              "items": { "type": "string" }
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
