{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://matrixnetwork.me/schemas/y-theory.teacher-journey-graph.v1.schema.json",
  "title": "Y-Theory Teacher Journey Graph",
  "description": "A release-bound teaching projection over governed pages, claims, wisdoms, and sources. It separates structural dependency, manifestation order, subject taxonomy, and learner sequence.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "version", "living_source_version", "status", "authority", "homepage", "relation_types", "views", "first_release", "input_hashes", "summary", "nodes", "edges", "record_coverage"],
  "properties": {
    "schema": {"const": "y-theory.teacher-journey-graph.v1"},
    "version": {"type": "string", "pattern": "^JNY-[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]+$"},
    "living_source_version": {"type": "string", "pattern": "^YLS-[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]+$"},
    "status": {"const": "governed_teacher_architecture_not_new_theory_proof"},
    "authority": {"$ref": "#/$defs/authority"},
    "homepage": {"$ref": "#/$defs/homepage"},
    "relation_types": {"type": "array", "minItems": 8, "maxItems": 8, "uniqueItems": true, "items": {"$ref": "#/$defs/relationType"}},
    "views": {"type": "array", "minItems": 4, "uniqueItems": true, "items": {"$ref": "#/$defs/view"}},
    "first_release": {"$ref": "#/$defs/firstRelease"},
    "input_hashes": {"$ref": "#/$defs/inputHashes"},
    "summary": {"$ref": "#/$defs/summary"},
    "nodes": {"type": "array", "minItems": 20, "items": {"$ref": "#/$defs/node"}},
    "edges": {"type": "array", "minItems": 20, "items": {"$ref": "#/$defs/edge"}},
    "record_coverage": {"$ref": "#/$defs/recordCoverage"}
  },
  "$defs": {
    "nonEmpty": {"type": "string", "minLength": 1},
    "idList": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/nonEmpty"}},
    "authority": {
      "type": "object", "additionalProperties": false,
      "required": ["canonical_author", "request", "boundary", "source_refs"],
      "properties": {
        "canonical_author": {"const": "Bubu Suhas Mullaveedu"},
        "request": {"$ref": "#/$defs/nonEmpty"},
        "boundary": {"$ref": "#/$defs/nonEmpty"},
        "source_refs": {"$ref": "#/$defs/idList"}
      }
    },
    "door": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "label", "href", "description"],
      "properties": {"id": {"$ref": "#/$defs/nonEmpty"}, "label": {"$ref": "#/$defs/nonEmpty"}, "href": {"$ref": "#/$defs/nonEmpty"}, "description": {"$ref": "#/$defs/nonEmpty"}}
    },
    "homepage": {
      "type": "object", "additionalProperties": false,
      "required": ["eyebrow", "heading", "introduction", "significance", "learner_outcomes", "primary_doors"],
      "properties": {
        "eyebrow": {"$ref": "#/$defs/nonEmpty"}, "heading": {"$ref": "#/$defs/nonEmpty"},
        "introduction": {"$ref": "#/$defs/nonEmpty"}, "significance": {"$ref": "#/$defs/nonEmpty"},
        "learner_outcomes": {"type": "array", "minItems": 5, "items": {"$ref": "#/$defs/nonEmpty"}},
        "primary_doors": {"type": "array", "minItems": 3, "maxItems": 3, "items": {"$ref": "#/$defs/door"}}
      }
    },
    "relationType": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "label", "acyclic", "meaning"],
      "properties": {"id": {"enum": ["requires", "capability_requires", "model_requires", "application_requires", "teaches_after", "manifests_after", "opens", "returns_to"]}, "label": {"$ref": "#/$defs/nonEmpty"}, "acyclic": {"type": "boolean"}, "meaning": {"$ref": "#/$defs/nonEmpty"}}
    },
    "view": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "label", "description", "edge_types", "root_node_ids"],
      "properties": {"id": {"enum": ["learner", "structure", "manifestation", "subjects"]}, "label": {"$ref": "#/$defs/nonEmpty"}, "description": {"$ref": "#/$defs/nonEmpty"}, "edge_types": {"$ref": "#/$defs/idList"}, "root_node_ids": {"$ref": "#/$defs/idList"}}
    },
    "firstRelease": {
      "type": "object", "additionalProperties": false,
      "required": ["label", "start_node_id", "end_node_id", "required_node_ids"],
      "properties": {"label": {"$ref": "#/$defs/nonEmpty"}, "start_node_id": {"$ref": "#/$defs/nonEmpty"}, "end_node_id": {"$ref": "#/$defs/nonEmpty"}, "required_node_ids": {"$ref": "#/$defs/idList"}}
    },
    "inputHashes": {
      "type": "object", "additionalProperties": false,
      "required": ["seed", "builder", "schema", "page_index", "page_record_index", "claims", "wisdom"],
      "properties": {"seed": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "builder": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "schema": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "page_index": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "page_record_index": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "claims": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "wisdom": {"type": "string", "pattern": "^[0-9a-f]{64}$"}}
    },
    "summary": {
      "type": "object", "additionalProperties": false,
      "required": ["nodes", "core_nodes", "subject_gateways", "edges", "first_release_nodes", "mapped_claims", "mapped_wisdoms", "source_references"],
      "properties": {"nodes": {"type": "integer", "minimum": 1}, "core_nodes": {"type": "integer", "minimum": 1}, "subject_gateways": {"type": "integer", "minimum": 1}, "edges": {"type": "integer", "minimum": 1}, "first_release_nodes": {"type": "integer", "minimum": 1}, "mapped_claims": {"type": "integer", "minimum": 1}, "mapped_wisdoms": {"type": "integer", "minimum": 1}, "source_references": {"type": "integer", "minimum": 1}}
    },
    "recordCounts": {
      "type": "object", "additionalProperties": false,
      "required": ["pages", "claims", "wisdoms", "source_references"],
      "properties": {"pages": {"type": "integer", "minimum": 1}, "claims": {"type": "integer", "minimum": 0}, "wisdoms": {"type": "integer", "minimum": 0}, "source_references": {"type": "integer", "minimum": 1}}
    },
    "node": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "order", "track", "phase", "kind", "title", "short_title", "domain", "content_state", "authority_state", "question", "inherited_context", "narrative", "new_relation", "learner_action", "explains", "holds_back", "page_ids", "claim_ids", "wisdom_ids", "source_refs", "visual_kind", "previous_node_ids", "next_node_ids", "branch_node_ids", "checkpoint", "record_counts"],
      "properties": {
        "id": {"type": "string", "pattern": "^[js][0-9]{2,}$"}, "order": {"type": "integer", "minimum": 0},
        "track": {"enum": ["core", "subject"]}, "phase": {"enum": ["first_release", "later_route", "subject_portal"]},
        "kind": {"enum": ["core_stage", "subject_gateway"]}, "title": {"$ref": "#/$defs/nonEmpty"}, "short_title": {"$ref": "#/$defs/nonEmpty"},
        "domain": {"type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"}, "content_state": {"enum": ["available", "mapped", "portal", "placeholder", "candidate"]},
        "authority_state": {"const": "governed_teaching_projection"}, "question": {"$ref": "#/$defs/nonEmpty"}, "inherited_context": {"$ref": "#/$defs/nonEmpty"},
        "narrative": {"$ref": "#/$defs/nonEmpty"}, "new_relation": {"$ref": "#/$defs/nonEmpty"}, "learner_action": {"$ref": "#/$defs/nonEmpty"},
        "explains": {"$ref": "#/$defs/idList"}, "holds_back": {"$ref": "#/$defs/idList"}, "page_ids": {"$ref": "#/$defs/idList"},
        "claim_ids": {"$ref": "#/$defs/idList"}, "wisdom_ids": {"$ref": "#/$defs/idList"}, "source_refs": {"$ref": "#/$defs/idList"},
        "visual_kind": {"type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"}, "previous_node_ids": {"$ref": "#/$defs/idList"}, "next_node_ids": {"$ref": "#/$defs/idList"}, "branch_node_ids": {"$ref": "#/$defs/idList"},
        "checkpoint": {"enum": ["none", "first_release_end", "learner_navigation_not_theory_closure"]}, "record_counts": {"$ref": "#/$defs/recordCounts"}
      }
    },
    "edge": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "from", "to", "type", "label", "authority_state", "semantic_boundary"],
      "properties": {"id": {"$ref": "#/$defs/nonEmpty"}, "from": {"type": "string", "pattern": "^[js][0-9]{2,}$"}, "to": {"type": "string", "pattern": "^[js][0-9]{2,}$"}, "type": {"enum": ["requires", "capability_requires", "model_requires", "application_requires", "teaches_after", "manifests_after", "opens", "returns_to"]}, "label": {"$ref": "#/$defs/nonEmpty"}, "authority_state": {"const": "governed_teaching_projection"}, "semantic_boundary": {"$ref": "#/$defs/nonEmpty"}}
    },
    "recordCoverage": {
      "type": "object", "additionalProperties": false,
      "required": ["claim_records", "mapped_claim_records", "unmapped_claim_ids", "wisdom_records", "mapped_wisdom_records", "unmapped_wisdom_ids", "mapping_boundary"],
      "properties": {"claim_records": {"type": "integer", "minimum": 0}, "mapped_claim_records": {"type": "integer", "minimum": 0}, "unmapped_claim_ids": {"$ref": "#/$defs/idList"}, "wisdom_records": {"type": "integer", "minimum": 0}, "mapped_wisdom_records": {"type": "integer", "minimum": 0}, "unmapped_wisdom_ids": {"$ref": "#/$defs/idList"}, "mapping_boundary": {"$ref": "#/$defs/nonEmpty"}}
    }
  }
}
