{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Document Structure Input",
  "description": "Input schema for the document-structure skill: add, remove or reorder chapters and sections.",
  "type": "object",
  "required": [
    "document",
    "operation"
  ],
  "properties": {
    "document": {
      "type": "string",
      "description": "Document slug under content/."
    },
    "operation": {
      "type": "string",
      "enum": [
        "add-chapter",
        "add-section",
        "reorder-chapters",
        "reorder-sections"
      ],
      "description": "Structural change to make. Reordering edits the manifest only — directories are never renamed, because labels, uses[], feedback and QA sidecars all key on names."
    },
    "chapter": {
      "type": "string",
      "description": "Chapter directory name. Required for every operation except reorder-chapters."
    },
    "title": {
      "type": "string",
      "description": "Human-readable title, for the add-* operations."
    },
    "position": {
      "type": "integer",
      "description": "Zero-based index to insert at. Appends when omitted."
    },
    "order": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The complete new order, for the reorder-* operations. Must be a permutation of the existing entries."
    }
  },
  "$id": "https://litlfred.github.io/folio-assistant/folio-assistant-core/schema/skills/document-structure/input.schema.json"
}
