{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "ResolvedHandle": {
      "type": "object",
      "properties": {
        "ref": {
          "type": "string"
        },
        "refStability": {
          "enum": [
            "stable",
            "ephemeral"
          ]
        },
        "targetKind": {
          "$ref": "#/$defs/TargetKind"
        }
      },
      "additionalProperties": false,
      "required": [
        "ref",
        "refStability",
        "targetKind"
      ]
    },
    "TargetKind": {
      "anyOf": [
        {
          "enum": [
            "text",
            "node",
            "list",
            "comment",
            "trackedChange",
            "table",
            "tableCell",
            "tableOfContents",
            "section",
            "sdt",
            "field"
          ]
        },
        {
          "type": "string",
          "pattern": "^ext:.+$"
        }
      ]
    },
    "PageInfo": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer",
          "minimum": 0
        },
        "offset": {
          "type": "integer",
          "minimum": 0
        },
        "returned": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "required": [
        "limit",
        "offset",
        "returned"
      ]
    }
  },
  "operationId": "toc.list",
  "schemas": {
    "input": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer"
        },
        "offset": {
          "type": "integer"
        }
      },
      "additionalProperties": false
    },
    "output": {
      "type": "object",
      "properties": {
        "evaluatedRevision": {
          "type": "string"
        },
        "total": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "handle": {
                "$ref": "#/$defs/ResolvedHandle"
              },
              "address": {
                "type": "object",
                "properties": {
                  "kind": {
                    "const": "block"
                  },
                  "nodeType": {
                    "const": "tableOfContents"
                  },
                  "nodeId": {
                    "type": "string"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "kind",
                  "nodeType",
                  "nodeId"
                ]
              },
              "instruction": {
                "type": "string"
              },
              "sourceConfig": {
                "type": "object"
              },
              "displayConfig": {
                "type": "object"
              },
              "preserved": {
                "type": "object"
              },
              "entryCount": {
                "type": "integer"
              }
            },
            "additionalProperties": false,
            "required": [
              "id",
              "handle",
              "address",
              "instruction",
              "entryCount"
            ]
          }
        },
        "page": {
          "$ref": "#/$defs/PageInfo"
        }
      },
      "additionalProperties": false,
      "required": [
        "evaluatedRevision",
        "total",
        "items",
        "page"
      ]
    }
  }
}
