{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "ListItemAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "const": "listItem"
        },
        "nodeId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "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"
      ]
    },
    "AffectedRefRemapping": {
      "type": "object",
      "properties": {
        "from": {
          "$ref": "#/$defs/AffectedRef"
        },
        "to": {
          "$ref": "#/$defs/AffectedRef"
        }
      },
      "additionalProperties": false,
      "required": [
        "from",
        "to"
      ]
    },
    "AffectedRef": {
      "oneOf": [
        {
          "$ref": "#/$defs/TextAddress"
        },
        {
          "$ref": "#/$defs/BookmarkAddress"
        },
        {
          "$ref": "#/$defs/CommentAddress"
        },
        {
          "$ref": "#/$defs/TrackedChangeAddress"
        },
        {
          "$ref": "#/$defs/BlockNavigationAddress"
        }
      ]
    },
    "TextAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "text"
        },
        "blockId": {
          "type": "string"
        },
        "range": {
          "$ref": "#/$defs/Range"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "blockId",
        "range"
      ]
    },
    "Range": {
      "type": "object",
      "properties": {
        "start": {
          "type": "integer"
        },
        "end": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "required": [
        "start",
        "end"
      ]
    },
    "BookmarkAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "bookmark"
        },
        "name": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "name"
      ]
    },
    "CommentAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "comment"
        },
        "entityId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "entityId"
      ]
    },
    "TrackedChangeAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "trackedChange"
        },
        "entityId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "entityId"
      ]
    },
    "BlockNavigationAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeId": {
          "type": "string"
        },
        "nodeType": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeId"
      ]
    },
    "TextRangeShift": {
      "type": "object",
      "properties": {
        "story": {
          "$ref": "#/$defs/StoryLocator"
        },
        "atChar": {
          "type": "integer"
        },
        "delta": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "required": [
        "story",
        "atChar",
        "delta"
      ]
    }
  },
  "operationId": "lists.setLevelStart",
  "schemas": {
    "input": {
      "type": "object",
      "properties": {
        "target": {
          "$ref": "#/$defs/ListItemAddress"
        },
        "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8
        },
        "startAt": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "target",
        "level",
        "startAt"
      ]
    },
    "output": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "success": {
              "const": true
            },
            "item": {
              "$ref": "#/$defs/ListItemAddress"
            },
            "affectedStories": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/StoryLocator"
              }
            },
            "remappedRefs": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/AffectedRefRemapping"
              }
            },
            "textRangeShifts": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/TextRangeShift"
              }
            },
            "txId": {
              "type": "string"
            },
            "changed": {
              "type": "boolean"
            },
            "trackedChangeRefs": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/TrackedChangeAddress"
              }
            }
          },
          "additionalProperties": false,
          "required": [
            "success",
            "item"
          ]
        },
        {
          "type": "object",
          "properties": {
            "success": {
              "const": false
            },
            "failure": {
              "type": "object",
              "properties": {
                "code": {
                  "enum": [
                    "NO_OP",
                    "INVALID_TARGET",
                    "INVALID_INPUT",
                    "LEVEL_OUT_OF_RANGE",
                    "LEVEL_NOT_FOUND"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "details": {}
              },
              "additionalProperties": false,
              "required": [
                "code",
                "message"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "success",
            "failure"
          ]
        }
      ]
    },
    "success": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "item": {
          "$ref": "#/$defs/ListItemAddress"
        },
        "affectedStories": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StoryLocator"
          }
        },
        "remappedRefs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AffectedRefRemapping"
          }
        },
        "textRangeShifts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TextRangeShift"
          }
        },
        "txId": {
          "type": "string"
        },
        "changed": {
          "type": "boolean"
        },
        "trackedChangeRefs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TrackedChangeAddress"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "item"
      ]
    },
    "failure": {
      "type": "object",
      "properties": {
        "success": {
          "const": false
        },
        "failure": {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "NO_OP",
                "INVALID_TARGET",
                "INVALID_INPUT",
                "LEVEL_OUT_OF_RANGE",
                "LEVEL_NOT_FOUND"
              ]
            },
            "message": {
              "type": "string"
            },
            "details": {}
          },
          "additionalProperties": false,
          "required": [
            "code",
            "message"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "failure"
      ]
    }
  }
}
