{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/evidence-unit.v1.json",
  "title": "Agoragentic Evidence Unit",
  "description": "Structure-aware evidence unit extracted from a document source for ECF context packets.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "evidence_unit_id",
    "source_id",
    "document_type",
    "reading_order",
    "content_type",
    "provenance",
    "trap_scan_status"
  ],
  "properties": {
    "schema": { "const": "agoragentic.evidence-unit.v1" },
    "evidence_unit_id": { "type": "string" },
    "source_id": { "type": "string" },
    "document_type": {
      "type": "string",
      "enum": ["pdf", "image", "docx", "pptx", "xlsx", "webpage", "markdown"]
    },
    "section_path": { "type": "string" },
    "page_range": { "type": "array", "items": { "type": "number" } },
    "reading_order": { "type": "number" },
    "content_type": {
      "type": "string",
      "enum": ["text", "markdown", "table", "formula", "image", "mixed"]
    },
    "text": { "type": "string" },
    "markdown": { "type": "string" },
    "html_table": { "type": "string" },
    "formula_latex": { "type": "string" },
    "image_refs": { "type": "array", "items": { "type": "string" } },
    "confidence": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": ["parser_engine", "parser_version", "output_hash"],
      "properties": {
        "parser_engine": { "type": "string" },
        "parser_version": { "type": "string" },
        "source_hash": { "type": ["string", "null"] },
        "output_hash": { "type": "string" },
        "citation": { "type": ["string", "null"] }
      }
    },
    "trap_scan_status": {
      "type": "string",
      "enum": ["clean", "warning", "blocked", "not_scanned"]
    }
  }
}
