{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dynamicfeed.ai/evidence-graph/graph-schema.json",
  "title": "Dynamic Feed Decision Evidence Graph fixture (deg-fixture/0.1)",
  "description": "Public preview fixture format for the Decision Evidence Graph Explorer. Demonstration and sanitized data only. References in; verifiable evidence out: verification semantics come exclusively from the published Trust Receipt v1 package.",
  "type": "object",
  "required": ["schema", "graph_id", "title", "layout_seed", "demonstration", "honesty", "nodes", "edges"],
  "additionalProperties": false,
  "properties": {
    "schema": { "const": "deg-fixture/0.1" },
    "graph_id": { "$ref": "#/$defs/id" },
    "title": { "type": "string", "minLength": 1, "maxLength": 160 },
    "description": { "type": "string", "maxLength": 2000 },
    "layout_seed": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
    "demonstration": {
      "type": "object",
      "required": ["status", "not_live_claim"],
      "additionalProperties": false,
      "properties": {
        "status": { "enum": ["synthetic", "sanitized"] },
        "not_live_claim": { "const": true },
        "note": { "type": "string", "maxLength": 600 }
      }
    },
    "honesty": {
      "type": "object",
      "required": ["verifiable", "reported_only", "missing", "uncertain"],
      "additionalProperties": false,
      "properties": {
        "verifiable": { "type": "array", "items": { "type": "string", "maxLength": 300 }, "maxItems": 20 },
        "reported_only": { "type": "array", "items": { "type": "string", "maxLength": 300 }, "maxItems": 20 },
        "missing": { "type": "array", "items": { "type": "string", "maxLength": 300 }, "maxItems": 20 },
        "uncertain": { "type": "array", "items": { "type": "string", "maxLength": 300 }, "maxItems": 20 }
      }
    },
    "nodes": { "type": "array", "minItems": 1, "maxItems": 150000, "items": { "$ref": "#/$defs/node" } },
    "edges": { "type": "array", "maxItems": 400000, "items": { "$ref": "#/$defs/edge" } }
  },
  "$defs": {
    "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{2,99}$" },
    "timestamp": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]+)?(?:Z|[+-][0-9]{2}:[0-9]{2})$" },
    "envelope": {
      "type": "object",
      "required": ["id", "schema_version", "created_at", "integrity_state", "sensitivity", "retention", "limitations"],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "schema_version": { "const": "deg/0.1" },
        "created_at": { "$ref": "#/$defs/timestamp" },
        "actor_ref": { "type": "string", "maxLength": 200 },
        "source_ref": { "type": "string", "maxLength": 200 },
        "evidence_ref": { "type": "string", "maxLength": 300,
          "description": "Reference to a verifiable artifact; for this preview, only paths into the published Trust Receipt v1 conformance package are verifiable." },
        "integrity_state": { "enum": ["verifiable", "reported", "missing", "uncertain", "tampered_demo"] },
        "sensitivity": { "enum": ["public", "sanitized", "synthetic"] },
        "retention": { "enum": ["demonstration", "ephemeral", "archival"] },
        "limitations": { "type": "array", "items": { "type": "string", "maxLength": 300 }, "maxItems": 10 },
        "external_ref": { "type": "string", "maxLength": 500,
          "description": "Opaque external identifier or https URL. Never dereferenced by the explorer without the http(s) allowlist." }
      }
    },
    "node": {
      "allOf": [
        { "$ref": "#/$defs/envelope" },
        {
          "type": "object",
          "required": ["type", "label"],
          "properties": {
            "type": { "enum": ["Source", "Observation", "TrustReceipt", "EvidenceBundle", "DecisionReference", "AgentHandoff", "ActionReference", "Outcome", "Review", "Correction", "Supersession"] },
            "label": { "type": "string", "minLength": 1, "maxLength": 140 },
            "summary": { "type": "string", "maxLength": 1000 },
            "occurred_at": { "$ref": "#/$defs/timestamp" },
            "freshness_at_use": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "state": { "enum": ["live", "stale", "unavailable", "unknown"] },
                "age_seconds": { "type": "number", "minimum": 0 }
              }
            }
          }
        }
      ]
    },
    "edge": {
      "allOf": [
        { "$ref": "#/$defs/envelope" },
        {
          "type": "object",
          "required": ["type", "from", "to"],
          "properties": {
            "type": { "enum": ["OBSERVED_FROM", "SEALED_AS", "DERIVED_FROM", "SUPPORTS", "CONTRADICTS", "USED_BY", "DELEGATED_TO", "AUTHORIZED", "TRIGGERED", "RESULTED_IN", "REVIEWED_BY", "CORRECTS", "SUPERSEDES", "VERIFIED_BY"] },
            "from": { "$ref": "#/$defs/id" },
            "to": { "$ref": "#/$defs/id" }
          }
        }
      ]
    }
  }
}
