{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "BlockAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "const": "paragraph"
        },
        "nodeId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "BlockAddressOrRange": {
      "oneOf": [
        {
          "$ref": "#/$defs/BlockAddress"
        },
        {
          "$ref": "#/$defs/BlockRange"
        }
      ]
    },
    "BlockRange": {
      "type": "object",
      "properties": {
        "from": {
          "$ref": "#/$defs/BlockAddress"
        },
        "to": {
          "$ref": "#/$defs/BlockAddress"
        }
      },
      "additionalProperties": false,
      "required": [
        "from",
        "to"
      ]
    },
    "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"
      ]
    }
  },
  "operationId": "lists.create",
  "schemas": {
    "input": {
      "type": "object",
      "properties": {
        "mode": {
          "enum": [
            "empty",
            "fromParagraphs"
          ],
          "description": "Required. 'fromParagraphs' converts existing paragraphs into list items: each paragraph becomes one item, so create one paragraph per item first. 'empty' creates a new empty list at 'at'."
        },
        "at": {
          "$ref": "#/$defs/BlockAddress",
          "description": "Required when mode is 'empty'. The paragraph to create the list at. Format: {kind:'block', nodeType:'paragraph', nodeId:'<id>'}."
        },
        "target": {
          "$ref": "#/$defs/BlockAddressOrRange",
          "description": "Required when mode is 'fromParagraphs'. Each call converts ONE paragraph into a list item. To make a list with N items, create N separate paragraphs first, then call superdoc_list create for EACH one. Format: {kind:'block', nodeType:'paragraph', nodeId:'<id>'}."
        },
        "kind": {
          "enum": [
            "ordered",
            "bullet"
          ],
          "description": "List type: 'bullet' for bullet points, 'ordered' for numbered lists."
        },
        "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8,
          "description": "List nesting level (0-8). 0 is the top level."
        },
        "preset": {
          "enum": [
            "decimal",
            "decimalParenthesis",
            "lowerLetter",
            "lowerLetterParenthesis",
            "upperLetter",
            "upperLetterParenthesis",
            "lowerRoman",
            "upperRoman",
            "disc",
            "circle",
            "square",
            "dash"
          ],
          "description": "Predefined list style preset. Overrides 'kind' with a specific numbering or bullet format."
        },
        "style": {
          "type": "object",
          "properties": {
            "version": {
              "const": 1
            },
            "levels": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "level": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 8
                  },
                  "numFmt": {
                    "type": "string"
                  },
                  "lvlText": {
                    "type": "string"
                  },
                  "start": {
                    "type": "integer"
                  },
                  "alignment": {
                    "enum": [
                      "left",
                      "center",
                      "right"
                    ]
                  },
                  "indents": {
                    "type": "object",
                    "properties": {
                      "left": {
                        "type": "integer"
                      },
                      "hanging": {
                        "type": "integer"
                      },
                      "firstLine": {
                        "type": "integer"
                      }
                    },
                    "additionalProperties": false
                  },
                  "trailingCharacter": {
                    "enum": [
                      "tab",
                      "space",
                      "nothing"
                    ]
                  },
                  "markerFont": {
                    "type": "string"
                  },
                  "pictureBulletId": {
                    "type": "integer"
                  },
                  "tabStopAt": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "additionalProperties": false,
                "required": [
                  "level"
                ]
              }
            }
          },
          "additionalProperties": false,
          "required": [
            "version",
            "levels"
          ]
        },
        "sequence": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "mode": {
                  "const": "new"
                },
                "startAt": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "additionalProperties": false,
              "required": [
                "mode"
              ]
            },
            {
              "type": "object",
              "properties": {
                "mode": {
                  "const": "continuePrevious"
                }
              },
              "additionalProperties": false,
              "required": [
                "mode"
              ]
            }
          ]
        }
      },
      "required": [
        "mode"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "empty"
              }
            }
          },
          "then": {
            "required": [
              "mode",
              "at"
            ]
          },
          "else": {
            "required": [
              "mode",
              "target"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "sequence": {
                "properties": {
                  "mode": {
                    "const": "continuePrevious"
                  }
                },
                "required": [
                  "mode"
                ]
              }
            },
            "required": [
              "sequence"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "preset"
                  ]
                },
                {
                  "required": [
                    "style"
                  ]
                }
              ]
            }
          }
        }
      ]
    },
    "output": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "success": {
              "const": true
            },
            "listId": {
              "type": "string"
            },
            "item": {
              "$ref": "#/$defs/ListItemAddress"
            }
          },
          "additionalProperties": false,
          "required": [
            "success",
            "listId",
            "item"
          ]
        },
        {
          "type": "object",
          "properties": {
            "success": {
              "const": false
            },
            "failure": {
              "type": "object",
              "properties": {
                "code": {
                  "enum": [
                    "INVALID_TARGET",
                    "LEVEL_OUT_OF_RANGE",
                    "INVALID_INPUT",
                    "NO_COMPATIBLE_PREVIOUS"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "details": {}
              },
              "additionalProperties": false,
              "required": [
                "code",
                "message"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "success",
            "failure"
          ]
        }
      ]
    },
    "success": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "listId": {
          "type": "string"
        },
        "item": {
          "$ref": "#/$defs/ListItemAddress"
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "listId",
        "item"
      ]
    },
    "failure": {
      "type": "object",
      "properties": {
        "success": {
          "const": false
        },
        "failure": {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "INVALID_TARGET",
                "LEVEL_OUT_OF_RANGE",
                "INVALID_INPUT",
                "NO_COMPATIBLE_PREVIOUS"
              ]
            },
            "message": {
              "type": "string"
            },
            "details": {}
          },
          "additionalProperties": false,
          "required": [
            "code",
            "message"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "failure"
      ]
    }
  }
}
