{
  "$defs": {
    "Citation": {
      "additionalProperties": false,
      "properties": {
        "content_hash": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "uri": {
          "type": "string"
        }
      },
      "required": [
        "uri"
      ],
      "type": "object"
    },
    "Element": {
      "additionalProperties": false,
      "properties": {
        "attributes": {
          "additionalProperties": {
            "$ref": "#/$defs/SemanticValue"
          },
          "type": "object"
        },
        "citations": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "type": "array"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "icon": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "parent": {
          "type": [
            "string",
            "null"
          ]
        },
        "pin": {
          "anyOf": [
            {
              "$ref": "#/$defs/Point"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "label",
        "kind"
      ],
      "type": "object"
    },
    "MessageDelivery": {
      "description": "Delivery semantics for sequence messages. This is intentionally separate\nfrom `kind`: kind describes the relationship's role (`message`, `flow`, or\na domain-specific type), while delivery controls protocol meaning and its\nvisual encoding.",
      "enum": [
        "call",
        "return",
        "async"
      ],
      "type": "string"
    },
    "MotionAction": {
      "enum": [
        "reveal",
        "focus",
        "flow",
        "state",
        "compare",
        "camera"
      ],
      "type": "string"
    },
    "MotionDirection": {
      "enum": [
        "forward",
        "reverse"
      ],
      "type": "string"
    },
    "MotionEffect": {
      "enum": [
        "draw_on",
        "blink",
        "pulse",
        "flow"
      ],
      "type": "string"
    },
    "MotionOptions": {
      "additionalProperties": false,
      "description": "Effects run simultaneously on the step targets. Continuous effects are ambient:\nthey never delay navigation, and stop when the selected state changes.",
      "properties": {
        "delay_ms": {
          "default": 0,
          "format": "uint32",
          "maximum": 60000,
          "minimum": 0,
          "type": "integer"
        },
        "direction": {
          "$ref": "#/$defs/MotionDirection",
          "default": "forward"
        },
        "effects": {
          "items": {
            "$ref": "#/$defs/MotionEffect"
          },
          "maxItems": 4,
          "minItems": 1,
          "type": "array"
        },
        "repetition": {
          "$ref": "#/$defs/MotionRepetition",
          "default": {
            "count": 1,
            "kind": "finite"
          }
        }
      },
      "required": [
        "effects"
      ],
      "type": "object"
    },
    "MotionRepetition": {
      "oneOf": [
        {
          "additionalProperties": false,
          "properties": {
            "count": {
              "format": "uint16",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            },
            "kind": {
              "const": "finite",
              "type": "string"
            }
          },
          "required": [
            "kind",
            "count"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "continuous",
              "type": "string"
            }
          },
          "required": [
            "kind"
          ],
          "type": "object"
        }
      ]
    },
    "Point": {
      "additionalProperties": false,
      "properties": {
        "x": {
          "format": "float",
          "maximum": 3.4028234663852886e+38,
          "minimum": -3.4028234663852886e+38,
          "type": "number"
        },
        "y": {
          "format": "float",
          "maximum": 3.4028234663852886e+38,
          "minimum": -3.4028234663852886e+38,
          "type": "number"
        }
      },
      "required": [
        "x",
        "y"
      ],
      "type": "object"
    },
    "Relationship": {
      "additionalProperties": false,
      "properties": {
        "attributes": {
          "additionalProperties": {
            "$ref": "#/$defs/SemanticValue"
          },
          "type": "object"
        },
        "citations": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "type": "array"
        },
        "delivery": {
          "anyOf": [
            {
              "$ref": "#/$defs/MessageDelivery"
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "target": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "source",
        "target",
        "label",
        "kind"
      ],
      "type": "object"
    },
    "SemanticValue": {
      "oneOf": [
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "text",
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "identifier",
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "number",
              "type": "string"
            },
            "value": {
              "format": "double",
              "type": "number"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "boolean",
              "type": "string"
            },
            "value": {
              "type": "boolean"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "identifiers",
              "type": "string"
            },
            "value": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "numbers",
              "type": "string"
            },
            "value": {
              "items": {
                "format": "double",
                "type": "number"
              },
              "type": "array"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "type": "object"
        }
      ]
    },
    "Story": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "steps": {
          "items": {
            "$ref": "#/$defs/StoryStep"
          },
          "type": "array"
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "title",
        "steps"
      ],
      "type": "object"
    },
    "StoryStep": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "$ref": "#/$defs/MotionAction"
        },
        "duration_ms": {
          "default": 550,
          "format": "uint32",
          "maximum": 60000,
          "minimum": 80,
          "type": "integer"
        },
        "id": {
          "type": "string"
        },
        "motion": {
          "anyOf": [
            {
              "$ref": "#/$defs/MotionOptions"
            },
            {
              "type": "null"
            }
          ]
        },
        "targets": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "value": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "action",
        "targets"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "element": {
          "$ref": "#/$defs/Element"
        },
        "type": {
          "const": "add_element",
          "type": "string"
        }
      },
      "required": [
        "type",
        "element"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "icon": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "parent": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "const": "update_element",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "point": {
          "$ref": "#/$defs/Point"
        },
        "type": {
          "const": "pin_element",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id",
        "point"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "const": "unpin_element",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "const": "remove_element",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "relationship": {
          "$ref": "#/$defs/Relationship"
        },
        "type": {
          "const": "add_relationship",
          "type": "string"
        }
      },
      "required": [
        "type",
        "relationship"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "Edit a relationship without changing its identity, citations or story targets.",
      "properties": {
        "delivery": {
          "anyOf": [
            {
              "$ref": "#/$defs/MessageDelivery"
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "target": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "const": "update_relationship",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "const": "remove_relationship",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "const": "set_element_attribute",
          "type": "string"
        },
        "value": {
          "$ref": "#/$defs/SemanticValue"
        }
      },
      "required": [
        "type",
        "id",
        "name",
        "value"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "const": "unset_element_attribute",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id",
        "name"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "const": "set_relationship_attribute",
          "type": "string"
        },
        "value": {
          "$ref": "#/$defs/SemanticValue"
        }
      },
      "required": [
        "type",
        "id",
        "name",
        "value"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "const": "unset_relationship_attribute",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id",
        "name"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "const": "set_document_option",
          "type": "string"
        },
        "value": {
          "$ref": "#/$defs/SemanticValue"
        }
      },
      "required": [
        "type",
        "name",
        "value"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "const": "unset_document_option",
          "type": "string"
        }
      },
      "required": [
        "type",
        "name"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "story": {
          "$ref": "#/$defs/Story"
        },
        "type": {
          "const": "add_story",
          "type": "string"
        }
      },
      "required": [
        "type",
        "story"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "step": {
          "$ref": "#/$defs/StoryStep"
        },
        "story_id": {
          "type": "string"
        },
        "type": {
          "const": "add_story_step",
          "type": "string"
        }
      },
      "required": [
        "type",
        "story_id",
        "step"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "step_id": {
          "type": "string"
        },
        "story_id": {
          "type": "string"
        },
        "type": {
          "const": "remove_story_step",
          "type": "string"
        }
      },
      "required": [
        "type",
        "story_id",
        "step_id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "theme": {
          "type": "string"
        },
        "type": {
          "const": "set_theme",
          "type": "string"
        }
      },
      "required": [
        "type",
        "theme"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "citation": {
          "$ref": "#/$defs/Citation"
        },
        "target_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "const": "attach_citation",
          "type": "string"
        }
      },
      "required": [
        "type",
        "citation"
      ],
      "type": "object"
    }
  ],
  "title": "DiagramOperation"
}
