{
  "openapi": "3.1.0",
  "info": {
    "title": "Unterweisungsmappe API",
    "version": "1.0.0"
  },
  "components": {
    "securitySchemes": {
      "session": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "errors": {}
        },
        "required": [
          "error"
        ]
      },
      "ConnectedApp": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Client name, e.g. Claude or ChatGPT"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "userEmail": {
            "type": [
              "string",
              "null"
            ],
            "description": "Member who connected it"
          },
          "connectedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "scopes",
          "userEmail",
          "connectedAt"
        ]
      },
      "ClaudeIssuer": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": [
              "string",
              "null"
            ],
            "description": "Aussteller-URL aus Claude (https://identity.anthropic.com/issuers/…), null = aus"
          },
          "tenantId": {
            "type": "string",
            "description": "Mandanten-ID dieses Betriebs für das optionale Feld „Tenant ID“ in Claude"
          },
          "setAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "issuer",
          "tenantId",
          "setAt"
        ]
      },
      "Avv": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ohne_daten",
              "offen",
              "abgeschlossen",
              "veraltet"
            ]
          },
          "currentVersion": {
            "type": "string"
          },
          "controller": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "company": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "address": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "representative": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "email": {
                "type": "string",
                "maxLength": 200,
                "format": "email"
              }
            },
            "required": [
              "company",
              "address",
              "representative",
              "email"
            ]
          },
          "acceptedVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "acceptedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "acceptedBy": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "currentVersion",
          "controller",
          "acceptedVersion",
          "acceptedAt",
          "acceptedBy"
        ],
        "description": "Controller data and acceptance of the data processing agreement (AVV) for this Betrieb."
      }
    },
    "parameters": {}
  },
  "paths": {
    "/api/health": {
      "get": {
        "summary": "Liveness check",
        "responses": {
          "200": {
            "description": "The app is up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/betrieb": {
      "get": {
        "summary": "Betrieb, Branche, verantwortliche Person, Kauf oder Test",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Name, Branche oder verantwortliche Person ändern",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "branche": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "verantwortlich": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 200
                      },
                      "funktion": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "telefon": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 50
                      }
                    },
                    "required": [
                      "name",
                      "telefon"
                    ]
                  },
                  "anschrift": {
                    "type": "object",
                    "properties": {
                      "strasse": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 200
                      },
                      "plz": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 5
                      },
                      "ort": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 100
                      }
                    },
                    "required": [
                      "strasse",
                      "plz",
                      "ort"
                    ]
                  },
                  "angaben": {
                    "type": "object",
                    "properties": {
                      "notruf": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "ersthelfer": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "maxItems": 20
                      },
                      "verbandkasten": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "feuerloescher": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "sammelstelle": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "brandschutzhelfer": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "maxItems": 20
                      },
                      "durchgangsarzt": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "fachkraft": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "betriebsarzt": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "sonstiges": {
                        "type": "string",
                        "maxLength": 300
                      }
                    }
                  },
                  "erinnerungen": {
                    "type": "boolean"
                  },
                  "brancheWechseln": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/branchen": {
      "get": {
        "summary": "Branchenvorlagen mit Tätigkeiten und Themen",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branchen": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "branchen"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/beschaeftigte": {
      "get": {
        "summary": "Aktive Beschäftigte",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "beschaeftigte": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "beschaeftigte"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Beschäftigte anlegen (ohne id), ändern oder archivieren (mit id)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "beschaeftigte": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "taetigkeiten": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 60
                          },
                          "maxItems": 30
                        },
                        "jugendlich": {
                          "type": "boolean"
                        },
                        "eintritt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 10
                        },
                        "email": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 200
                        },
                        "mobil": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 40
                        },
                        "zuletztUnterwiesen": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 10
                        },
                        "archivieren": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "taetigkeiten"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 200
                  }
                },
                "required": [
                  "beschaeftigte"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "beschaeftigte": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "beschaeftigte"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/gbu": {
      "get": {
        "summary": "Aktuelle Gefährdungsbeurteilung",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "gbu": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "gbu"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Neue Fassung aus der Branchenvorlage",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taetigkeiten": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 60
                    },
                    "maxItems": 30
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fristen": {
      "get": {
        "summary": "Fristen je Person und Thema (nach Kauf), dazu je Person der dringendste Stand",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fristen": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    },
                    "jePerson": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "fristen",
                    "jePerson"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/unterweisungen": {
      "get": {
        "summary": "Unterweisungen, neueste zuerst",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unterweisungen": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "unterweisungen"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Unterweisungen anlegen, je Person ein Link (im Test bis 2 Personen, ohne Nachweis)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "beschaeftigte": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "alle"
                        ]
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "minItems": 1,
                        "maxItems": 200
                      }
                    ]
                  },
                  "art": {
                    "type": "string",
                    "enum": [
                      "ERST",
                      "WIEDERHOLUNG",
                      "ANLASS"
                    ]
                  },
                  "anlass": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "themen": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 60
                    },
                    "maxItems": 40
                  },
                  "versenden": {
                    "type": "boolean"
                  },
                  "ohneThemen": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 60
                    },
                    "maxItems": 40
                  }
                },
                "required": [
                  "beschaeftigte",
                  "art"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unterweisungen": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    },
                    "hinweise": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "unterweisungen",
                    "hinweise"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/unterweisungen/senden": {
      "post": {
        "summary": "Links per Mail an die Beschäftigten schicken (wo eine Adresse hinterlegt ist)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "unterweisungen": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "minItems": 1,
                    "maxItems": 200
                  }
                },
                "required": [
                  "unterweisungen"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "versendet": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "ohneMail": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "kuerzlich": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "versendet",
                    "ohneMail",
                    "kuerzlich"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fehlt": {
      "get": {
        "summary": "Wer fehlt: je Person der offene Schritt",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/unterweisungen/{id}/verwerfen": {
      "post": {
        "summary": "Verwerfen vorbereiten: Das angemeldete Mitglied bestätigt Unterweisung und Grund über den zurückgegebenen Link",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "grund": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 300
                  }
                },
                "required": [
                  "grund"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/unterweisungen/{id}/neuer-link": {
      "post": {
        "summary": "Neuer Link, der alte gilt nicht mehr",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/nachgespraech": {
      "post": {
        "summary": "Nachgespräch festhalten",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "unterweisungen": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "minItems": 1,
                    "maxItems": 200
                  },
                  "am": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "art": {
                    "type": "string",
                    "enum": [
                      "vor_ort",
                      "telefon",
                      "video"
                    ]
                  },
                  "von": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  },
                  "notiz": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "ersetzen": {
                    "type": "boolean"
                  },
                  "unterschriftPapier": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "unterweisungen",
                  "am",
                  "art",
                  "von"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unterweisungen": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "unterweisungen"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pdf/{art}": {
      "get": {
        "summary": "Gefährdungsbeurteilung (frei) oder Unterweisungsnachweis (nach Kauf) als PDF",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "gbu",
                "nachweis"
              ]
            },
            "required": true,
            "name": "art",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/connected-apps": {
      "get": {
        "summary": "Über OAuth verbundene Apps (MCP)",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connectedApps": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ConnectedApp"
                      }
                    }
                  },
                  "required": [
                    "connectedApps"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/connected-apps/{id}": {
      "delete": {
        "summary": "App trennen: ihre Token gelten sofort nicht mehr",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Getrennt"
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/claude-issuer": {
      "get": {
        "summary": "Claude Team/Enterprise: eingetragene Aussteller-URL (nur Inhaber und Admins)",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaudeIssuer"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nur Inhaber und Admins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Claude Team/Enterprise: Aussteller-URL eintragen oder mit null entfernen (nur Inhaber und Admins)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issuer": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  }
                },
                "required": [
                  "issuer"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaudeIssuer"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nur Inhaber und Admins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/billing/checkout": {
      "post": {
        "summary": "Polar-Checkout für den Einmalkauf starten (ein Preis für alle Betriebsgrößen)",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nur Inhaber und Admins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Kauf noch nicht verfügbar",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/kauf": {
      "get": {
        "summary": "Ob der Einmalkauf gerade möglich ist, und der Preis (netto, EUR)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "verfuegbar": {
                      "type": "boolean"
                    },
                    "preisNetto": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "verfuegbar",
                    "preisNetto"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/billing/sync": {
      "post": {
        "summary": "Ergebnis eines Checkouts lesen",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checkoutId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "checkoutId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "access"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/billing/portal": {
      "post": {
        "summary": "Kundenportal bei Polar (Rechnungen)",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/u/{token}": {
      "get": {
        "summary": "Inhalte und offene Fragen einer Unterweisung (ohne Lösungen), wahlweise übersetzt",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 10,
              "maxLength": 200
            },
            "required": true,
            "name": "token",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 5
            },
            "required": false,
            "name": "sprache",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/u-ungueltig": {
      "get": {
        "summary": "Text der Handy-Seite für einen ungültigen Link in einer Sprache (ohne Link keine Sprache vom Server)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 5
            },
            "required": false,
            "name": "sprache",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "titel": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "titel",
                    "text"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/u/{token}/antwort": {
      "post": {
        "summary": "Antwort auf eine Verständnisfrage prüfen",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 10,
              "maxLength": 200
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "thema": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "frage": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 50
                  },
                  "antwort": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10
                  },
                  "sprache": {
                    "type": "string",
                    "maxLength": 5
                  }
                },
                "required": [
                  "thema",
                  "frage",
                  "antwort"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "richtig": {
                      "type": "boolean"
                    },
                    "erklaerung": {
                      "type": "string"
                    },
                    "ersatz": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "richtig",
                    "erklaerung",
                    "ersatz"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/u/{token}/bestaetigen": {
      "post": {
        "summary": "Unterweisung bestätigen (alle Fragen richtig, Name)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 10,
              "maxLength": 200
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "gelesen": {
                    "type": "boolean"
                  },
                  "sprache": {
                    "type": "string",
                    "maxLength": 5
                  }
                },
                "required": [
                  "name",
                  "gelesen"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bestaetigtAm": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "bestaetigtAm"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/u/{token}/unterschrift": {
      "post": {
        "summary": "Unterschrift für die mündliche Unterweisung vor Ort (Bild der Unterschrift, PNG)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 10,
              "maxLength": 200
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "bild": {
                    "type": "string",
                    "maxLength": 300000
                  }
                },
                "required": [
                  "name",
                  "bild"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unterschriftAm": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "unterschriftAm"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/avv": {
      "get": {
        "summary": "Data processing agreement (AVV) of the Betrieb",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Avv"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Set the controller data of the AVV (session only, owners and admins); a real change clears an earlier acceptance",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "company": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "address": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "representative": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email"
                  }
                },
                "required": [
                  "company",
                  "address",
                  "representative",
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Avv"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Owners and admins only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/avv/accept": {
      "post": {
        "summary": "Accept the current AVV version (session only, owners and admins)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string"
                  },
                  "controller": {
                    "type": "object",
                    "properties": {
                      "company": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "address": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "representative": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "email": {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email"
                      }
                    },
                    "required": [
                      "company",
                      "address",
                      "representative",
                      "email"
                    ]
                  }
                },
                "required": [
                  "version",
                  "controller"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Avv"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "This needs the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Owners and admins only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Controller data missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/inhalte": {
      "get": {
        "summary": "Öffentliche Seiten (mit Markdown-Fassung), Preis, Fragen und Impressum",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/inhalte/suche": {
      "get": {
        "summary": "Suche über alle öffentlichen Seiten",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200
            },
            "required": true,
            "name": "q",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "treffer": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "titel": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "markdownUrl": {
                            "type": "string"
                          },
                          "auszug": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "titel",
                          "url",
                          "markdownUrl",
                          "auszug"
                        ]
                      }
                    }
                  },
                  "required": [
                    "treffer"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
