{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/kubohiroya/turbowarp-scene-graph/main/schemas/scene-node.schema.json",
  "title": "TurboWarp Scene Graph Node",
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "sceneGraphScalar": {
      "type": [
        "string",
        "number",
        "boolean",
        "null"
      ]
    },
    "sceneGraphScalarArray": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/sceneGraphScalar"
      }
    },
    "sceneGraphScalarObject": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1
      },
      "additionalProperties": {
        "$ref": "#/$defs/sceneGraphScalar"
      }
    },
    "sceneGraphValue": {
      "oneOf": [
        {
          "$ref": "#/$defs/sceneGraphScalar"
        },
        {
          "$ref": "#/$defs/sceneGraphScalarArray"
        },
        {
          "$ref": "#/$defs/sceneGraphScalarObject"
        }
      ]
    }
  },
  "properties": {
    "type": {
      "type": "string",
      "minLength": 1
    },
    "id": {
      "type": "string",
      "minLength": 1
    },
    "class": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        }
      ]
    },
    "classes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "data": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1
      },
      "additionalProperties": {
        "$ref": "#/$defs/sceneGraphValue"
      }
    },
    "attributes": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1
      },
      "additionalProperties": {
        "$ref": "#/$defs/sceneGraphValue"
      }
    },
    "children": {
      "type": "array",
      "items": {
        "$ref": "#"
      }
    }
  }
}
