{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://law.arxo.io/schema/case-export.schema.json",
 "title": "Arxo case export 0.1", "$comment": "SPEC §168.5; DECISION-0169",
 "type": "object",
 "additionalProperties": false,
 "required": [
  "schemaVersion",
  "source",
  "records",
  "bindings",
  "evidence",
  "supportEdges",
  "verifications",
  "documents",
  "contentHash"
 ],
 "properties": {
  "schemaVersion": {
   "const": "law.case-export/0.1"
  },
  "source": {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "package",
    "case",
    "resolutionHash"
   ],
   "properties": {
    "package": {
     "type": "object",
     "additionalProperties": false,
     "required": [
      "name",
      "version",
      "namespace"
     ],
     "properties": {
      "name": {
       "type": "string"
      },
      "version": {
       "type": "string"
      },
      "namespace": {
       "type": "string"
      }
     }
    },
    "case": {
     "type": "string",
     "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
    },
    "resolutionHash": {
     "type": "string",
     "pattern": "^sha256:[0-9a-f]{64}$"
    }
   }
  },
  "records": {
   "description": "Selected case assertion nodes as in case.json, with explicit ids; order is export order.",
   "type": "array",
   "minItems": 1,
   "items": {
    "$ref": "legal-ir.schema.json#/$defs/Assertion"
   }
  },
  "bindings": {
   "description": "Case constants referenced by the entries: StableId → value term (as in case.constants).",
   "type": "object",
   "additionalProperties": true
  },
  "evidence": {
   "type": "array",
   "items": {
    "$ref": "legal-ir.schema.json#/$defs/EvidenceItem"
   }
  },
  "supportEdges": {
   "type": "array",
   "items": {
    "$ref": "legal-ir.schema.json#/$defs/SupportEdge"
   }
  },
  "verifications": {
   "type": "array",
   "items": {
    "$ref": "evaluation-request.schema.json#/$defs/EvidenceVerification"
   }
  },
  "documents": {
   "description": "Snapshot document attachments: path within the snapshot directory (documents/…) and sha256 of the bytes.",
   "type": "array",
   "items": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "path",
     "contentHash"
    ],
    "properties": {
     "path": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(?!/).+$"
     },
     "contentHash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
     }
    }
   }
  },
  "contentHash": {
   "description": "sha256 of the artifact's canonical bytes without this field (non-recursive).",
   "type": "string",
   "pattern": "^sha256:[0-9a-f]{64}$"
  }
 }
}
