{
  "openapi": "3.1.0",
  "info": {
    "title": "Dispatcher Task API",
    "description": "Sendet Aufgaben und Entscheidungen direkt an Victors lokales KI-System. Tasks werden von Claude Code ausgeführt. Decisions und Context werden nur gespeichert.",
    "version": "1.1.0"
  },
  "servers": [
    {
      "url": "https://tasks.beachorchestra.com"
    }
  ],
  "paths": {
    "/api/task/submit": {
      "post": {
        "operationId": "submitTask",
        "summary": "Aufgabe an Dispatcher senden",
        "description": "Sendet eine strukturierte Aufgabe, Entscheidung oder Kontext-Information an den lokalen Dispatcher. type='task' wird von Claude Code ausgeführt. type='decision' und type='context' werden nur gespeichert.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["type", "title", "payload"],
                "properties": {
                  "from": {
                    "type": "string",
                    "default": "chatgpt",
                    "description": "Quelle des Auftrags. Immer 'chatgpt' setzen."
                  },
                  "type": {
                    "type": "string",
                    "enum": ["task", "decision", "context"],
                    "description": "task=wird ausgeführt, decision=nur gespeichert, context=Wissen speichern"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Kurze Beschreibung (max. 120 Zeichen)"
                  },
                  "payload": {
                    "type": "string",
                    "description": "Vollständige Aufgabenbeschreibung für Claude Code."
                  },
                  "priority": {
                    "type": "string",
                    "enum": ["high", "normal"],
                    "default": "normal"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task erfolgreich in die Queue gelegt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {"type": "boolean"},
                    "id": {"type": "string"},
                    "status": {"type": "string"}
                  }
                }
              }
            }
          },
          "401": {"description": "Unauthorized"},
          "429": {"description": "Tageslimit erreicht"}
        }
      }
    },
    "/api/task/status": {
      "get": {
        "operationId": "getTaskStatus",
        "summary": "Status aller Tasks abrufen",
        "description": "Gibt Anzahl und Liste der Tasks zurück: OUTBOX, PROCESSING, DONE, ERROR.",
        "responses": {
          "200": {
            "description": "Aktueller Status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {"type": "boolean"},
                    "outbox": {"type": "object"},
                    "processing": {"type": "object"},
                    "done": {"type": "object"},
                    "error": {"type": "object"}
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
