{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "format": {
      "enum": [
        "noshakhe.mindmap",
        "shakhe.mindmap"
      ]
    },
    "version": {
      "const": 1
    },
    "kind": {
      "enum": [
        "mindmap",
        "flow",
        "multiflow",
        "brace",
        "tree",
        "bubble"
      ]
    },
    "root": {
      "$ref": "#/$defs/topic"
    }
  },
  "required": [
    "format",
    "version",
    "root"
  ],
  "$defs": {
    "topic": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "role": {
          "enum": [
            "cause",
            "effect"
          ]
        },
        "text": {
          "type": "string",
          "maxLength": 160
        },
        "note": {
          "type": "string",
          "maxLength": 2000
        },
        "children": {
          "type": "array",
          "maxItems": 24,
          "items": {
            "$ref": "#/$defs/topic"
          }
        },
        "style": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "light": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "fill": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "stroke": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "text": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "width": {
                  "enum": [
                    0,
                    1,
                    2,
                    3
                  ]
                }
              }
            },
            "dark": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "fill": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "stroke": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "text": {
                  "type": "string",
                  "pattern": "^#[a-fA-F0-9]{6}$"
                },
                "width": {
                  "enum": [
                    0,
                    1,
                    2,
                    3
                  ]
                }
              }
            }
          }
        }
      },
      "required": [
        "text"
      ]
    }
  }
}
