{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "StoryLocator": {
      "description": "Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "body"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterSlot"
            },
            "section": {
              "$ref": "#/$defs/SectionAddress"
            },
            "headerFooterKind": {
              "enum": [
                "header",
                "footer"
              ]
            },
            "variant": {
              "enum": [
                "default",
                "first",
                "even"
              ]
            },
            "resolution": {
              "enum": [
                "effective",
                "explicit"
              ]
            },
            "onWrite": {
              "enum": [
                "materializeIfInherited",
                "editResolvedPart",
                "error"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "section",
            "headerFooterKind",
            "variant"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterPart"
            },
            "refId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "refId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "footnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "endnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "textbox"
            },
            "textboxId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "textboxId"
          ]
        }
      ]
    },
    "SectionAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "section"
        },
        "sectionId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "sectionId"
      ]
    },
    "TrackedChangeAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "trackedChange"
        },
        "entityId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "entityId"
      ]
    }
  },
  "operationId": "trackChanges.get",
  "schemas": {
    "input": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "id"
      ]
    },
    "output": {
      "type": "object",
      "properties": {
        "address": {
          "$ref": "#/$defs/TrackedChangeAddress"
        },
        "id": {
          "type": "string"
        },
        "type": {
          "enum": [
            "insertion",
            "deletion",
            "replacement",
            "formatting",
            "move",
            "structural",
            "insert",
            "delete",
            "format"
          ]
        },
        "subtype": {
          "type": "string"
        },
        "state": {
          "enum": [
            "open",
            "accepted",
            "rejected"
          ]
        },
        "target": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "enum": [
                    "text"
                  ]
                },
                "address": {
                  "$ref": "#/$defs/TrackedChangeAddress"
                }
              },
              "additionalProperties": false,
              "required": [
                "kind",
                "address"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "enum": [
                    "replacement"
                  ]
                },
                "address": {
                  "$ref": "#/$defs/TrackedChangeAddress"
                }
              },
              "additionalProperties": false,
              "required": [
                "kind",
                "address"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "enum": [
                    "formatting"
                  ]
                },
                "address": {
                  "$ref": "#/$defs/TrackedChangeAddress"
                },
                "subtype": {
                  "enum": [
                    "run",
                    "paragraph",
                    "list",
                    "table",
                    "row",
                    "cell",
                    "section"
                  ]
                }
              },
              "additionalProperties": false,
              "required": [
                "kind",
                "address",
                "subtype"
              ]
            }
          ]
        },
        "before": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "Visible text snapshot when the affected revision is text-shaped."
            },
            "formatting": {
              "type": "object",
              "properties": {
                "xml": {
                  "type": "string",
                  "description": "Raw OOXML for the property block on this side."
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "Subtype-aware semantic property map for formatting revisions."
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "after": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "Visible text snapshot when the affected revision is text-shaped."
            },
            "formatting": {
              "type": "object",
              "properties": {
                "xml": {
                  "type": "string",
                  "description": "Raw OOXML for the property block on this side."
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "Subtype-aware semantic property map for formatting revisions."
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "sourceIds": {
          "type": "object",
          "properties": {
            "wordIdInsert": {
              "type": "string",
              "description": "Word `w:id` value from the insertion side of this logical change."
            },
            "wordIdDelete": {
              "type": "string",
              "description": "Word `w:id` value from the deletion side of this logical change."
            },
            "wordIdOther": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Word `w:id` values from other wrappers (for example moveFrom/moveTo)."
            },
            "rsids": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Word revision-save ids (`w:rsidR` / `w:rsidDel`) seen on contributing wrappers."
            }
          },
          "additionalProperties": false,
          "description": "Canonical multi-side source provenance. Provenance metadata only; never the canonical SuperDoc tracked-change id."
        },
        "wordRevisionIds": {
          "type": "object",
          "properties": {
            "insert": {
              "type": "string",
              "description": "Raw imported Word OOXML revision ID (`w:id`) from a `<w:ins>` element when this logical change includes an insertion."
            },
            "delete": {
              "type": "string",
              "description": "Raw imported Word OOXML revision ID (`w:id`) from a `<w:del>` element when this logical change includes a deletion."
            },
            "format": {
              "type": "string",
              "description": "Raw imported Word OOXML revision ID (`w:id`) from a `<w:rPrChange>` element when this logical change includes a formatting revision."
            }
          },
          "additionalProperties": false,
          "description": "Raw imported Word OOXML revision IDs (`w:id`) from the source document when available. This is provenance metadata, not the canonical SuperDoc tracked-change ID. Replacements may include both `insert` and `delete` IDs."
        },
        "revisionGroupId": {
          "type": "string"
        },
        "splitFromId": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "replacement": {
          "type": "object",
          "properties": {
            "inserted": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable SuperDoc-internal side id."
                    },
                    "excerpt": {
                      "type": "string",
                      "description": "Visible text excerpt on this side."
                    },
                    "wordId": {
                      "type": "string",
                      "description": "Raw Word `w:id` for this side, when known."
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "excerpt"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "deleted": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable SuperDoc-internal side id."
                    },
                    "excerpt": {
                      "type": "string",
                      "description": "Visible text excerpt on this side."
                    },
                    "wordId": {
                      "type": "string",
                      "description": "Raw Word `w:id` for this side, when known."
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "excerpt"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "inserted",
            "deleted"
          ]
        },
        "author": {
          "type": "string"
        },
        "authorEmail": {
          "type": "string"
        },
        "authorImage": {
          "type": "string"
        },
        "initials": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "storyLocator": {
          "$ref": "#/$defs/StoryLocator"
        },
        "sourcePlatform": {
          "enum": [
            "word",
            "google-docs",
            "superdoc",
            "unknown"
          ]
        },
        "grouping": {
          "enum": [
            "standalone",
            "replacement-pair",
            "unknown"
          ]
        },
        "pairedWithChangeId": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "insertedText": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "deletedText": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "formattingDeltaSummary": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Human-readable formatting delta summary for formatting changes; null otherwise."
        },
        "listDeltas": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "enum": [
                  "list-add",
                  "list-remove",
                  "list-level",
                  "list-style",
                  "list-restart",
                  "indent",
                  "other-format"
                ],
                "description": "Semantic list-delta classification for this member (spec TC-LIST-004)."
              },
              "from": {
                "type": "object",
                "properties": {
                  "hasNumPr": {
                    "type": "boolean",
                    "description": "Explicit numPr element present in the property block on this side."
                  },
                  "numId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Effective list membership numId; non-positive numIds normalize to null."
                  },
                  "ilvl": {
                    "oneOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Explicit ilvl value; null when the source omitted it (effective level 0)."
                  },
                  "styleKind": {
                    "oneOf": [
                      {
                        "enum": [
                          "bullet",
                          "number",
                          "letter",
                          "roman",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Resolved visual style kind via the numbering model; null when unresolvable."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "hasNumPr",
                  "numId",
                  "ilvl",
                  "styleKind"
                ]
              },
              "to": {
                "type": "object",
                "properties": {
                  "hasNumPr": {
                    "type": "boolean",
                    "description": "Explicit numPr element present in the property block on this side."
                  },
                  "numId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Effective list membership numId; non-positive numIds normalize to null."
                  },
                  "ilvl": {
                    "oneOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Explicit ilvl value; null when the source omitted it (effective level 0)."
                  },
                  "styleKind": {
                    "oneOf": [
                      {
                        "enum": [
                          "bullet",
                          "number",
                          "letter",
                          "roman",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Resolved visual style kind via the numbering model; null when unresolvable."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "hasNumPr",
                  "numId",
                  "ilvl",
                  "styleKind"
                ]
              },
              "levelDirection": {
                "enum": [
                  "indent",
                  "outdent"
                ],
                "description": "Direction of a list-level change."
              },
              "restartAt": {
                "type": "number",
                "description": "Restart value for a list-restart change (numbering-model derived)."
              }
            },
            "additionalProperties": false,
            "required": [
              "kind",
              "from",
              "to"
            ]
          },
          "description": "Structured per-member list semantic deltas for tracked list formatting changes (spec TC-LIST-003/004); absent for non-list changes."
        },
        "listDeltaSummary": {
          "type": "object",
          "properties": {
            "uniformKind": {
              "oneOf": [
                {
                  "enum": [
                    "list-add",
                    "list-remove",
                    "list-level",
                    "list-style",
                    "list-restart",
                    "indent",
                    "other-format"
                  ]
                },
                {
                  "type": "null"
                }
              ],
              "description": "The single delta kind shared by every member, or null for mixed groups."
            },
            "counts": {
              "type": "object",
              "properties": {
                "list-add": {
                  "type": "number"
                },
                "list-remove": {
                  "type": "number"
                },
                "list-level": {
                  "type": "number"
                },
                "list-style": {
                  "type": "number"
                },
                "list-restart": {
                  "type": "number"
                },
                "indent": {
                  "type": "number"
                },
                "other-format": {
                  "type": "number"
                }
              },
              "additionalProperties": false,
              "description": "Non-zero member counts per delta kind."
            }
          },
          "additionalProperties": false,
          "required": [
            "uniformKind",
            "counts"
          ]
        },
        "targetIsListItem": {
          "type": "boolean",
          "description": "For paragraph-mark structural changes: whether the target paragraph is a direct-numbered list item."
        },
        "listActionKind": {
          "enum": [
            "merge-items"
          ],
          "description": "Stable presentation fact on the merge-owner deletion change (spec TC-LIST-005)."
        },
        "origin": {
          "enum": [
            "word",
            "google-docs",
            "superdoc",
            "unknown"
          ]
        },
        "imported": {
          "type": "boolean"
        },
        "canonicalizationKind": {
          "enum": [
            "single-word-revision",
            "paired-word-revision",
            "generated-runtime-id",
            "unknown"
          ]
        },
        "addressKind": {
          "enum": [
            "entity",
            "story-entity",
            "unknown"
          ]
        },
        "resolvableById": {
          "type": "boolean"
        },
        "excerpt": {
          "type": "string"
        },
        "overlap": {
          "type": "object",
          "properties": {
            "visualLayers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "SuperDoc logical tracked-change id for this overlap layer."
                  },
                  "type": {
                    "enum": [
                      "insertion",
                      "deletion",
                      "replacement",
                      "formatting",
                      "move",
                      "structural",
                      "insert",
                      "delete",
                      "format"
                    ],
                    "description": "Canonical broad tracked-change type for this layer."
                  },
                  "relationship": {
                    "enum": [
                      "parent",
                      "child",
                      "standalone"
                    ]
                  }
                },
                "additionalProperties": false,
                "required": [
                  "id",
                  "type",
                  "relationship"
                ]
              },
              "description": "Ordered overlap layers, with the parent surface first and child layers after it."
            },
            "preferredContextTargetId": {
              "type": "string",
              "description": "Preferred child tracked-change id for context-menu/comment targeting."
            },
            "preferredContextTarget": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "SuperDoc logical tracked-change id for this overlap layer."
                },
                "type": {
                  "enum": [
                    "insertion",
                    "deletion",
                    "replacement",
                    "formatting",
                    "move",
                    "structural",
                    "insert",
                    "delete",
                    "format"
                  ],
                  "description": "Canonical broad tracked-change type for this layer."
                },
                "relationship": {
                  "enum": [
                    "parent",
                    "child",
                    "standalone"
                  ]
                }
              },
              "additionalProperties": false,
              "required": [
                "id",
                "type",
                "relationship"
              ]
            },
            "relationship": {
              "enum": [
                "parent",
                "child",
                "standalone"
              ]
            },
            "parentId": {
              "type": "string",
              "description": "Parent logical tracked-change id when this change is an overlap child."
            }
          },
          "additionalProperties": false
        },
        "customAttributes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "namespaceUri": {
                "type": "string"
              },
              "localName": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": [
              "name",
              "namespaceUri",
              "localName",
              "value"
            ]
          },
          "description": "Unknown extension attributes in document order; exact duplicates are removed and conflicting values are retained."
        }
      },
      "additionalProperties": false,
      "required": [
        "address",
        "id",
        "type"
      ]
    }
  }
}
