{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://matrixnetwork.me/schemas/y-theory-mind-object-body-projection-v1.json",
  "title": "Y-Theory MindObject Body and Projection Read Model",
  "description": "Separate read-only Body/Projection contract derived from the structural source-field Mind.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "status",
    "source_field",
    "body_contract",
    "projection_contract",
    "mind_object_views",
    "nodes",
    "role_addresses",
    "candidate_relation_views",
    "semantic_graph_edges",
    "capability_boundary",
    "counts",
    "input_hashes",
    "guardrails"
  ],
  "properties": {
    "schema": {"const": "y-theory.mind-object-body-projection.v1"},
    "status": {"const": "separate_derived_read_model_no_reverse_authority_write"},
    "source_field": {"$ref": "#/$defs/sourceField"},
    "body_contract": {"$ref": "#/$defs/bodyContract"},
    "projection_contract": {"$ref": "#/$defs/projectionContract"},
    "mind_object_views": {
      "type": "array",
      "minItems": 1,
      "items": {"$ref": "#/$defs/mindObjectView"}
    },
    "nodes": {
      "type": "array",
      "minItems": 1,
      "items": {"$ref": "#/$defs/node"}
    },
    "role_addresses": {
      "type": "array",
      "minItems": 3,
      "items": {"$ref": "#/$defs/roleAddress"}
    },
    "candidate_relation_views": {"const": []},
    "semantic_graph_edges": {"const": []},
    "capability_boundary": {"$ref": "#/$defs/capabilityBoundary"},
    "counts": {"$ref": "#/$defs/counts"},
    "input_hashes": {"$ref": "#/$defs/inputHashes"},
    "guardrails": {
      "type": "array",
      "minItems": 4,
      "uniqueItems": true,
      "items": {"type": "string", "minLength": 1}
    }
  },
  "$defs": {
    "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
    "sourceField": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "artifact_sha256", "canonical_state_hash", "fixed_point_verified"],
      "properties": {
        "path": {"const": "atlas/model/MIND_OBJECT_SOURCE_FIELD.json"},
        "artifact_sha256": {"$ref": "#/$defs/sha256"},
        "canonical_state_hash": {"$ref": "#/$defs/sha256"},
        "fixed_point_verified": {"const": true}
      }
    },
    "bodyContract": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "input_mode",
        "transformation",
        "source_write_authorized",
        "canonical_mutation_authorized",
        "semantic_edge_creation_authorized"
      ],
      "properties": {
        "kind": {"const": "field_to_manifestation_body_read_model"},
        "input_mode": {"const": "immutable_content_addressed_source_field"},
        "transformation": {"const": "derive_addressable_nodes_and_role_views_without_authority_change"},
        "source_write_authorized": {"const": false},
        "canonical_mutation_authorized": {"const": false},
        "semantic_edge_creation_authorized": {"const": false}
      }
    },
    "projectionContract": {
      "type": "object",
      "additionalProperties": false,
      "required": ["modes", "navigation_dimensions", "layout_is_mechanism_or_proof", "unresolved_roles_are_visible", "source_lineage_required"],
      "properties": {
        "modes": {"const": ["2d", "3d"]},
        "navigation_dimensions": {"const": ["mind_object", "scope", "role_address"]},
        "layout_is_mechanism_or_proof": {"const": false},
        "unresolved_roles_are_visible": {"const": true},
        "source_lineage_required": {"const": true}
      }
    },
    "mindObjectView": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mind_object_ref", "root_mind_cell_ref", "node_refs"],
      "properties": {
        "mind_object_ref": {"type": "string", "pattern": "^MO-"},
        "root_mind_cell_ref": {"type": "string", "pattern": "^MC::"},
        "node_refs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {"type": "string", "pattern": "^NODE::MC::"}
        }
      }
    },
    "node": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "mind_cell_ref", "mind_object_ref", "scope_id", "title", "structure_state", "observerhood_state", "experience_state", "source_field_state_hash"],
      "properties": {
        "id": {"type": "string", "pattern": "^NODE::MC::"},
        "mind_cell_ref": {"type": "string", "pattern": "^MC::"},
        "mind_object_ref": {"type": "string", "pattern": "^MO-"},
        "scope_id": {"type": "string", "pattern": "^[A-Z0-9-]+$"},
        "title": {"type": "string", "minLength": 1},
        "structure_state": {"const": "primitive_recursive_triad_instantiated"},
        "observerhood_state": {"const": "not_earned"},
        "experience_state": {"const": "not_earned"},
        "source_field_state_hash": {"$ref": "#/$defs/sha256"}
      }
    },
    "roleAddress": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "owner_mind_cell_ref", "role", "binding_state", "target_mind_cell_ref", "review_question", "display_only", "semantic_relation", "graph_edge"],
      "properties": {
        "id": {"type": "string", "pattern": "^VIEW::MC::"},
        "owner_mind_cell_ref": {"type": "string", "pattern": "^MC::"},
        "role": {"enum": ["inside", "outside", "relation"]},
        "binding_state": {"enum": ["mind_cell_reference", "governed_unresolved"]},
        "target_mind_cell_ref": {"type": ["string", "null"]},
        "review_question": {"type": ["string", "null"]},
        "display_only": {"const": true},
        "semantic_relation": {"const": false},
        "graph_edge": {"const": false}
      }
    },
    "capabilityBoundary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["structural_mind_visible", "observerhood_state", "experience_state", "consciousness_state", "presentation_cannot_earn_capabilities"],
      "properties": {
        "structural_mind_visible": {"const": true},
        "observerhood_state": {"const": "not_earned"},
        "experience_state": {"const": "not_earned"},
        "consciousness_state": {"const": "not_earned"},
        "presentation_cannot_earn_capabilities": {"const": true}
      }
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mind_object_views", "nodes", "role_addresses", "resolved_mind_cell_addresses", "governed_unresolved_addresses", "candidate_relation_views", "semantic_graph_edges"],
      "properties": {
        "mind_object_views": {"type": "integer", "minimum": 1},
        "nodes": {"type": "integer", "minimum": 1},
        "role_addresses": {"type": "integer", "minimum": 3},
        "resolved_mind_cell_addresses": {"type": "integer", "minimum": 0},
        "governed_unresolved_addresses": {"type": "integer", "minimum": 0},
        "candidate_relation_views": {"const": 0},
        "semantic_graph_edges": {"const": 0}
      }
    },
    "inputHashes": {
      "type": "object",
      "additionalProperties": false,
      "required": ["builder", "body_projection_schema", "source_field_artifact"],
      "properties": {
        "builder": {"$ref": "#/$defs/sha256"},
        "body_projection_schema": {"$ref": "#/$defs/sha256"},
        "source_field_artifact": {"$ref": "#/$defs/sha256"}
      }
    }
  }
}
