{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Quantum Invariants Spine Schema",
  "type": "object",
  "required": ["schema", "generated_at", "layer0_primitives", "layer1_composites"],
  "properties": {
    "schema": {
      "type": "object",
      "required": ["name", "version"],
      "properties": {
        "name": {"type": "string"},
        "version": {"type": "string"},
        "layer0_primitives_version": {"type": "string"},
        "layer1_composites_version": {"type": "string"}
      },
      "additionalProperties": true
    },
    "generated_at": {"type": "string"},
    "notes": {
      "type": "array",
      "items": {"type": "string"}
    },
    "layer0_primitives": {
      "type": "array",
      "items": {"$ref": "#/definitions/spineNode"}
    },
    "layer1_composites": {
      "type": "array",
      "items": {"$ref": "#/definitions/spineNode"}
    }
  },
  "definitions": {
    "symbol": {
      "type": "object",
      "properties": {
        "label": {"type": "string"},
        "glyph": {"type": "string"}
      },
      "additionalProperties": true
    },
    "statements": {
      "type": "object",
      "properties": {
        "direct": {"type": "string"},
        "mirror": {"type": "string"},
        "shadow": {"type": "string"},
        "shadow_mirror": {"type": "string"}
      },
      "additionalProperties": true
    },
    "spineNode": {
      "type": "object",
      "required": ["id", "title"],
      "properties": {
        "id": {"type": "string"},
        "title": {"type": "string"},
        "symbol": {"$ref": "#/definitions/symbol"},
        "statements": {"$ref": "#/definitions/statements"},
        "diagnostics": {
          "type": "array",
          "items": {"type": "string"}
        },
        "repairs": {
          "type": "array",
          "items": {"type": "string"}
        },
        "depends_on": {
          "type": "array",
          "items": {"type": "string"}
        },
        "use_cases": {
          "type": "array",
          "items": {"type": "string"}
        },
        "aliases": {
          "type": "array",
          "items": {"type": "string"}
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
