{
  "openapi": "3.1.0",
  "info": {
    "title": "hauswart API",
    "version": "1.0.0",
    "description": "Versioned JSON API of hauswart, used by the web app, the mobile app and integrations. Errors share one envelope: `{ error: { code, message, details? } }`. Cookie-authenticated requests that change state must send an `Origin` header equal to the app origin and `Content-Type: application/json`; bearer requests are exempt."
  },
  "tags": [
    {
      "name": "system"
    },
    {
      "name": "mcp"
    },
    {
      "name": "setup"
    },
    {
      "name": "auth"
    },
    {
      "name": "tokens"
    },
    {
      "name": "users"
    },
    {
      "name": "rooms"
    },
    {
      "name": "assets"
    },
    {
      "name": "tasks"
    },
    {
      "name": "dashboard"
    },
    {
      "name": "notifications"
    },
    {
      "name": "household"
    },
    {
      "name": "contacts"
    },
    {
      "name": "parts"
    },
    {
      "name": "service-log"
    },
    {
      "name": "vehicles"
    },
    {
      "name": "costs"
    },
    {
      "name": "finance"
    },
    {
      "name": "defects"
    },
    {
      "name": "insurance"
    },
    {
      "name": "asset-notes"
    },
    {
      "name": "appointments"
    },
    {
      "name": "warranties"
    },
    {
      "name": "comments"
    },
    {
      "name": "hints"
    },
    {
      "name": "docs"
    },
    {
      "name": "search"
    },
    {
      "name": "attachments"
    },
    {
      "name": "integrations"
    },
    {
      "name": "documents"
    },
    {
      "name": "calendar"
    },
    {
      "name": "emergency"
    },
    {
      "name": "guest-links"
    },
    {
      "name": "ai-tasks"
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "operationId": "health",
        "summary": "Liveness probe",
        "tags": [
          "system"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    },
                    "version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status",
                    "version"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "openapi",
        "summary": "OpenAPI document of this API",
        "tags": [
          "system"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "openapi": {
                      "type": "string"
                    },
                    "info": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "version": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "version"
                      ],
                      "additionalProperties": {}
                    },
                    "paths": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "openapi",
                    "info",
                    "paths"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, stateless)",
        "description": "The Model Context Protocol server of hauswart, for Claude Code and other MCP clients: `claude mcp add --transport http hauswart <address>/api/v1/mcp --header \"Authorization: Bearer hw_...\"`. Every POST carries one JSON-RPC message and is answered on its own (no session; the `Mcp-Session-Id` header is not used) with `application/json`; a notification is answered with 202 and no body. GET and DELETE are 405. The tools run through this API with the caller's token, so they offer what its scopes allow and completions are attributed to the token's kind. A request with an `Origin` header other than the app's own is refused with 403 `csrf_failed` (DNS rebinding); clients that are not browsers send none. Protocol and tools: mcp/README.md.",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "jsonrpc": {
                        "type": "string",
                        "const": "2.0"
                      }
                    },
                    "required": [
                      "jsonrpc"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "jsonrpc": {
                          "type": "string",
                          "const": "2.0"
                        }
                      },
                      "required": [
                        "jsonrpc"
                      ],
                      "additionalProperties": {}
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/setup": {
      "get": {
        "operationId": "setupStatus",
        "summary": "Whether first-run setup is still open",
        "description": "`needsSetup` is true until the first administrator account exists. `tokenRequired` is true while setup is open and the server was started with `HAUSWART_SETUP_TOKEN`: the setup request must then carry `setupToken`.",
        "tags": [
          "setup"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "needsSetup": {
                      "type": "boolean"
                    },
                    "tokenRequired": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "needsSetup",
                    "tokenRequired"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "setup",
        "summary": "Create the first administrator and sign in",
        "description": "Only works while no user exists (409 `setup_complete` afterwards). When the server runs with `HAUSWART_SETUP_TOKEN`, `setupToken` must match it (403 `forbidden`). Starts a browser session (sets the session cookie).",
        "tags": [
          "setup"
        ],
        "security": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `csrf_failed`, `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `setup_complete`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32,
                    "pattern": "^[a-z0-9._-]+$"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 256
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  },
                  "setupToken": {
                    "type": "string",
                    "maxLength": 256
                  }
                },
                "required": [
                  "username",
                  "displayName",
                  "password",
                  "locale"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "operationId": "authLogin",
        "summary": "Sign in with a username and password",
        "description": "Starts a browser session (sets the session cookie). Failed attempts are rate limited per user and client address.",
        "tags": [
          "auth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `invalid_credentials`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  }
                },
                "required": [
                  "username",
                  "password"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/logout": {
      "post": {
        "operationId": "authLogout",
        "summary": "End the current browser session",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/me": {
      "get": {
        "operationId": "authMe",
        "summary": "The calling user, how they authenticated and their effective scopes",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    },
                    "auth": {
                      "type": "string",
                      "enum": [
                        "session",
                        "token"
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "read",
                          "write",
                          "docs:write",
                          "costs:write",
                          "ha:action",
                          "admin"
                        ]
                      }
                    }
                  },
                  "required": [
                    "user",
                    "auth",
                    "scopes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "authUpdateMe",
        "summary": "Update the calling user's display name or language",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/me/password": {
      "post": {
        "operationId": "authChangePassword",
        "summary": "Change the calling user's own password",
        "description": "Needs the current password; a wrong one is a 400 field error on `currentPassword` (never 401, which would read as an expired session) and counts against the same failed-password budget as sign-in, so repeated guesses end in 429 with `Retry-After`. The new password follows the rules of setup and the administrator's reset (10 to 256 characters) and must differ from the current one. Every other browser session of the user ends; the session that made the call stays. API tokens stay valid (unlike an administrator's reset, which revokes them): revoke them with `DELETE /api/v1/tokens/{id}` when the password changed because of a leak.",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currentPassword": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "newPassword": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 256
                  }
                },
                "required": [
                  "currentPassword",
                  "newPassword"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/token": {
      "post": {
        "operationId": "authToken",
        "summary": "Exchange a username and password for a device token",
        "description": "Issues a `mobile` bearer token (scopes read, write, docs:write, costs:write; valid for 90 days). The token is shown once. Failed attempts share the login rate limit.",
        "tags": [
          "auth"
        ],
        "security": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "user": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "required": [
                    "token",
                    "expiresAt",
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `invalid_credentials`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "deviceName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "platform": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "username",
                  "password",
                  "deviceName"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "authRevokeToken",
        "summary": "Revoke the token used for this request",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokens": {
      "get": {
        "operationId": "tokensList",
        "summary": "List the calling user's API tokens",
        "description": "Never includes token values or hashes.",
        "tags": [
          "tokens"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiToken"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "tokensCreate",
        "summary": "Create an API token for an integration",
        "description": "The plaintext token is in the response and never shown again. Scopes cannot exceed the caller's own.",
        "tags": [
          "tokens"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedApiToken"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "integration",
                      "ha",
                      "mcp"
                    ]
                  },
                  "scopes": {
                    "minItems": 1,
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "read",
                        "write",
                        "docs:write",
                        "costs:write",
                        "ha:action",
                        "admin"
                      ]
                    }
                  },
                  "expiresAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "kind",
                  "scopes"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tokens/{id}": {
      "delete": {
        "operationId": "tokensRevoke",
        "summary": "Revoke one of the calling user's API tokens",
        "description": "Other users' tokens are not visible: 404.",
        "tags": [
          "tokens"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/users": {
      "get": {
        "operationId": "usersList",
        "summary": "List all users",
        "tags": [
          "users"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "x-required-scopes": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminUser"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "usersCreate",
        "summary": "Create a user",
        "tags": [
          "users"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "x-required-scopes": [
          "admin"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/AdminUser"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32,
                    "pattern": "^[a-z0-9._-]+$"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 256
                  },
                  "role": {
                    "default": "member",
                    "type": "string",
                    "enum": [
                      "admin",
                      "member"
                    ]
                  },
                  "locale": {
                    "default": "de",
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  },
                  "ownershipBps": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  }
                },
                "required": [
                  "username",
                  "displayName",
                  "password"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/users/{id}": {
      "patch": {
        "operationId": "usersUpdate",
        "summary": "Change a user's role, name, cost share or password",
        "description": "A password reset ends the user's sessions and revokes all of their live API tokens. Demoting an administrator revokes their tokens that hold the `admin` scope. The last administrator cannot be demoted.",
        "tags": [
          "users"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "x-required-scopes": [
          "admin"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/AdminUser"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "member"
                    ]
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "ownershipBps": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 256
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/rooms": {
      "get": {
        "operationId": "roomsList",
        "summary": "List rooms",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Room"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "roomsCreate",
        "summary": "Create a room",
        "description": "The slug is derived from the name unless given.",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Room"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "haAreaId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "icon": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/rooms/{id}": {
      "get": {
        "operationId": "roomsGet",
        "summary": "Get a room",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Room"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "roomsUpdate",
        "summary": "Update a room",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Room"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "haAreaId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "icon": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "roomsDelete",
        "summary": "Delete a room",
        "description": "Assets and tasks in the room stay and lose their room.",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/rooms/import-areas": {
      "post": {
        "operationId": "roomsImportAreas",
        "summary": "Take over areas of the connected system as rooms",
        "description": "Takes ids from `GET /integrations/{kind}/areas`. Per area, in one transaction: a room that already stores the area id is left alone (`unchanged`); an unlinked room with the same name takes the area id instead of a duplicate (`linked`); otherwise a room named like the area is created (`created`) with the area id in `haAreaId`. An area the system no longer lists answers `not_found` and changes nothing. Repeating the call changes nothing more, and renaming the area later never touches the room. 404 without a connection or for a kind without areas; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "rooms"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoomAreaImport"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "homeassistant",
                      "paperless",
                      "kept"
                    ]
                  },
                  "areaIds": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  }
                },
                "required": [
                  "kind",
                  "areaIds"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets": {
      "get": {
        "operationId": "assetsList",
        "summary": "List assets (devices, plants, fixtures)",
        "description": "Filter by kind, room or a search text (name, manufacturer, model, category, species and, for a vehicle, its plate: case, spaces, dots and dashes do not matter, so `zh 000.000` finds `ZH 000000`). Archived assets are left out unless includeArchived=true.",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "device",
                "plant",
                "fixture",
                "vehicle",
                "other"
              ]
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Asset"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetsCreate",
        "summary": "Create an asset",
        "description": "Gets a random qrSlug for QR deep links. The slug is derived from the name unless given.",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "default": "device",
                    "type": "string",
                    "enum": [
                      "device",
                      "plant",
                      "fixture",
                      "vehicle",
                      "other"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "manufacturer": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serialNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purchaseDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "installedDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyExtendedUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "showOnEmergency": {
                    "default": false,
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "species": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "light": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "waterNotes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "photoAttachmentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/by-qr/{qrSlug}": {
      "get": {
        "operationId": "assetsByQr",
        "summary": "Look up an asset by its QR slug",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "qrSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z2-7]{10}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}": {
      "get": {
        "operationId": "assetsGet",
        "summary": "Get an asset",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "assetsUpdate",
        "summary": "Update or archive an asset",
        "description": "Set archived to true to archive, false to restore. A vehicle that holds saved details, odometer readings or tire sets cannot change its kind: 400 with a field error on `kind` until they are removed (details saved with nothing in them do not count).",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "device",
                      "plant",
                      "fixture",
                      "vehicle",
                      "other"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "manufacturer": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serialNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purchaseDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "installedDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyExtendedUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "showOnEmergency": {
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "species": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "light": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "waterNotes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "photoAttachmentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "assetsDelete",
        "summary": "Delete an asset",
        "description": "Tasks of the asset stay and lose the link. Archive instead to keep it.",
        "tags": [
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks": {
      "get": {
        "operationId": "tasksList",
        "summary": "List tasks with their due state",
        "description": "Ordered overdue first, then by due date. assignee=me or a user id matches the current assignee.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ok",
                "open",
                "due",
                "overdue",
                "snoozed",
                "unknown"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "cleaning",
                "maintenance",
                "filter",
                "plant",
                "waste",
                "inspection",
                "payment",
                "order",
                "warranty",
                "defect",
                "other"
              ]
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "externalSource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "externalRef",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Task"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "tasksCreate",
        "summary": "Create a task",
        "description": "The trigger is validated by the due-date engine; the first due date is computed before the response.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "default": "",
                    "type": "string",
                    "maxLength": 50000
                  },
                  "category": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "cleaning",
                      "maintenance",
                      "filter",
                      "plant",
                      "waste",
                      "inspection",
                      "payment",
                      "order",
                      "warranty",
                      "defect",
                      "other"
                    ]
                  },
                  "priority": {
                    "default": "normal",
                    "type": "string",
                    "enum": [
                      "low",
                      "normal",
                      "high"
                    ]
                  },
                  "effortMinutes": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10080
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trigger": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "interval"
                          },
                          "every": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "unit": {
                            "type": "string",
                            "enum": [
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          },
                          "anchor": {
                            "type": "string",
                            "enum": [
                              "completion",
                              "schedule"
                            ]
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "seasons": {
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fromMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "toMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "every": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3650
                                },
                                "unit": {
                                  "type": "string",
                                  "enum": [
                                    "day",
                                    "week",
                                    "month",
                                    "year"
                                  ]
                                }
                              },
                              "required": [
                                "fromMonth",
                                "toMonth",
                                "every",
                                "unit"
                              ]
                            }
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "every",
                          "unit",
                          "anchor",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "calendar"
                          },
                          "freq": {
                            "type": "string",
                            "enum": [
                              "weekly",
                              "monthly",
                              "yearly"
                            ]
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "byWeekday": {
                            "minItems": 1,
                            "maxItems": 7,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            }
                          },
                          "byMonthDay": {
                            "type": "integer",
                            "minimum": -31,
                            "maximum": 31
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": -5,
                            "maximum": 5
                          },
                          "byMonth": {
                            "minItems": 1,
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 12
                            }
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "earlyDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 366
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "freq",
                          "interval",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "min_per_period"
                          },
                          "period": {
                            "type": "string",
                            "enum": [
                              "week",
                              "month",
                              "quarter",
                              "year"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "remindFromFraction": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "period",
                          "count"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "counter_delta"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "threshold": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "unit": {
                            "type": "string"
                          },
                          "orEvery": {
                            "type": "object",
                            "properties": {
                              "every": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3650
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "day",
                                  "week",
                                  "month",
                                  "year"
                                ]
                              }
                            },
                            "required": [
                              "every",
                              "unit"
                            ]
                          },
                          "autoCompleteOnReset": {
                            "type": "object",
                            "properties": {
                              "minDrop": {
                                "type": "number",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "minDrop"
                            ]
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "threshold"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "state_condition"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "op": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "ne",
                              "gt",
                              "gte",
                              "lt",
                              "lte"
                            ]
                          },
                          "value": {
                            "type": [
                              "string",
                              "number"
                            ]
                          },
                          "forMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          },
                          "estimateFrom": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "target": {
                                "type": "number"
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "down",
                                  "up"
                                ]
                              }
                            },
                            "required": [
                              "entityId",
                              "target",
                              "direction"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "op",
                          "value"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "ha_calendar"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "summaryMatch": {
                            "type": "string"
                          },
                          "offsetDays": {
                            "type": "integer",
                            "minimum": -366,
                            "maximum": 366
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "offsetDays"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "one_off"
                          },
                          "date": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "date"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "kept_bill"
                          },
                          "billId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "dueDate": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "paid",
                              "cancelled",
                              "overdue"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "billId",
                          "dueDate",
                          "status"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "warranty"
                          },
                          "until": {
                            "type": "string"
                          },
                          "extendedUntil": {
                            "type": "string"
                          },
                          "leadDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 3650
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "until"
                        ]
                      }
                    ]
                  },
                  "assignMode": {
                    "default": "none",
                    "type": "string",
                    "enum": [
                      "none",
                      "fixed",
                      "rotate"
                    ]
                  },
                  "assigneeUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rotationOrder": {
                    "default": [],
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "rotationStrategy": {
                    "default": "alternate",
                    "type": "string",
                    "enum": [
                      "alternate",
                      "fair"
                    ]
                  },
                  "notifyMode": {
                    "default": "assignee",
                    "type": "string",
                    "enum": [
                      "assignee",
                      "all"
                    ]
                  },
                  "graceDays": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "dueSoonDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "source": {
                    "default": "manual",
                    "type": "string",
                    "enum": [
                      "manual",
                      "seed",
                      "kept",
                      "paperless",
                      "ha",
                      "mcp",
                      "system"
                    ]
                  },
                  "externalSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title",
                  "trigger"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/preview": {
      "post": {
        "operationId": "tasksPreview",
        "summary": "Preview what a trigger would give",
        "description": "Evaluates the trigger as if it had never been completed. Nothing is stored. POST for the body; needs only read access.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DueResult"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "trigger": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "interval"
                          },
                          "every": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "unit": {
                            "type": "string",
                            "enum": [
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          },
                          "anchor": {
                            "type": "string",
                            "enum": [
                              "completion",
                              "schedule"
                            ]
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "seasons": {
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fromMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "toMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "every": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3650
                                },
                                "unit": {
                                  "type": "string",
                                  "enum": [
                                    "day",
                                    "week",
                                    "month",
                                    "year"
                                  ]
                                }
                              },
                              "required": [
                                "fromMonth",
                                "toMonth",
                                "every",
                                "unit"
                              ]
                            }
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "every",
                          "unit",
                          "anchor",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "calendar"
                          },
                          "freq": {
                            "type": "string",
                            "enum": [
                              "weekly",
                              "monthly",
                              "yearly"
                            ]
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "byWeekday": {
                            "minItems": 1,
                            "maxItems": 7,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            }
                          },
                          "byMonthDay": {
                            "type": "integer",
                            "minimum": -31,
                            "maximum": 31
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": -5,
                            "maximum": 5
                          },
                          "byMonth": {
                            "minItems": 1,
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 12
                            }
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "earlyDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 366
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "freq",
                          "interval",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "min_per_period"
                          },
                          "period": {
                            "type": "string",
                            "enum": [
                              "week",
                              "month",
                              "quarter",
                              "year"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "remindFromFraction": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "period",
                          "count"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "counter_delta"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "threshold": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "unit": {
                            "type": "string"
                          },
                          "orEvery": {
                            "type": "object",
                            "properties": {
                              "every": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3650
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "day",
                                  "week",
                                  "month",
                                  "year"
                                ]
                              }
                            },
                            "required": [
                              "every",
                              "unit"
                            ]
                          },
                          "autoCompleteOnReset": {
                            "type": "object",
                            "properties": {
                              "minDrop": {
                                "type": "number",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "minDrop"
                            ]
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "threshold"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "state_condition"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "op": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "ne",
                              "gt",
                              "gte",
                              "lt",
                              "lte"
                            ]
                          },
                          "value": {
                            "type": [
                              "string",
                              "number"
                            ]
                          },
                          "forMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          },
                          "estimateFrom": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "target": {
                                "type": "number"
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "down",
                                  "up"
                                ]
                              }
                            },
                            "required": [
                              "entityId",
                              "target",
                              "direction"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "op",
                          "value"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "ha_calendar"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "summaryMatch": {
                            "type": "string"
                          },
                          "offsetDays": {
                            "type": "integer",
                            "minimum": -366,
                            "maximum": 366
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "offsetDays"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "one_off"
                          },
                          "date": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "date"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "kept_bill"
                          },
                          "billId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "dueDate": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "paid",
                              "cancelled",
                              "overdue"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "billId",
                          "dueDate",
                          "status"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "warranty"
                          },
                          "until": {
                            "type": "string"
                          },
                          "extendedUntil": {
                            "type": "string"
                          },
                          "leadDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 3650
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "until"
                        ]
                      }
                    ]
                  },
                  "graceDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "dueSoonDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "today": {
                    "type": "string",
                    "format": "date"
                  }
                },
                "required": [
                  "trigger"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}": {
      "get": {
        "operationId": "tasksGet",
        "summary": "Get a task with preparations and recent completions",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "tasksUpdate",
        "summary": "Update or archive a task",
        "description": "Re-evaluates the task. archived=true archives, false restores.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "cleaning",
                      "maintenance",
                      "filter",
                      "plant",
                      "waste",
                      "inspection",
                      "payment",
                      "order",
                      "warranty",
                      "defect",
                      "other"
                    ]
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "low",
                      "normal",
                      "high"
                    ]
                  },
                  "effortMinutes": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10080
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trigger": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "interval"
                          },
                          "every": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "unit": {
                            "type": "string",
                            "enum": [
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          },
                          "anchor": {
                            "type": "string",
                            "enum": [
                              "completion",
                              "schedule"
                            ]
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "seasons": {
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fromMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "toMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "every": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3650
                                },
                                "unit": {
                                  "type": "string",
                                  "enum": [
                                    "day",
                                    "week",
                                    "month",
                                    "year"
                                  ]
                                }
                              },
                              "required": [
                                "fromMonth",
                                "toMonth",
                                "every",
                                "unit"
                              ]
                            }
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "every",
                          "unit",
                          "anchor",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "calendar"
                          },
                          "freq": {
                            "type": "string",
                            "enum": [
                              "weekly",
                              "monthly",
                              "yearly"
                            ]
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "byWeekday": {
                            "minItems": 1,
                            "maxItems": 7,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            }
                          },
                          "byMonthDay": {
                            "type": "integer",
                            "minimum": -31,
                            "maximum": 31
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": -5,
                            "maximum": 5
                          },
                          "byMonth": {
                            "minItems": 1,
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 12
                            }
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "earlyDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 366
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "freq",
                          "interval",
                          "startDate"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "min_per_period"
                          },
                          "period": {
                            "type": "string",
                            "enum": [
                              "week",
                              "month",
                              "quarter",
                              "year"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3650
                          },
                          "remindFromFraction": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "period",
                          "count"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "counter_delta"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "threshold": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "unit": {
                            "type": "string"
                          },
                          "orEvery": {
                            "type": "object",
                            "properties": {
                              "every": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3650
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "day",
                                  "week",
                                  "month",
                                  "year"
                                ]
                              }
                            },
                            "required": [
                              "every",
                              "unit"
                            ]
                          },
                          "autoCompleteOnReset": {
                            "type": "object",
                            "properties": {
                              "minDrop": {
                                "type": "number",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "minDrop"
                            ]
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "threshold"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "state_condition"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "op": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "ne",
                              "gt",
                              "gte",
                              "lt",
                              "lte"
                            ]
                          },
                          "value": {
                            "type": [
                              "string",
                              "number"
                            ]
                          },
                          "forMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          },
                          "estimateFrom": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "target": {
                                "type": "number"
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "down",
                                  "up"
                                ]
                              }
                            },
                            "required": [
                              "entityId",
                              "target",
                              "direction"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "op",
                          "value"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "ha_calendar"
                          },
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "summaryMatch": {
                            "type": "string"
                          },
                          "offsetDays": {
                            "type": "integer",
                            "minimum": -366,
                            "maximum": 366
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                          },
                          "autoComplete": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "counter_reset"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "minDrop": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "minDrop"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "state_change"
                                    },
                                    "entityId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "to": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 255
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "entityId",
                                    "to"
                                  ]
                                }
                              ]
                            }
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "entityId",
                          "offsetDays"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "one_off"
                          },
                          "date": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "date"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "kept_bill"
                          },
                          "billId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "dueDate": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "paid",
                              "cancelled",
                              "overdue"
                            ]
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "billId",
                          "dueDate",
                          "status"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "v": {
                            "type": "number",
                            "const": 1
                          },
                          "type": {
                            "type": "string",
                            "const": "warranty"
                          },
                          "until": {
                            "type": "string"
                          },
                          "extendedUntil": {
                            "type": "string"
                          },
                          "leadDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 3650
                          }
                        },
                        "required": [
                          "v",
                          "type",
                          "until"
                        ]
                      }
                    ]
                  },
                  "assignMode": {
                    "type": "string",
                    "enum": [
                      "none",
                      "fixed",
                      "rotate"
                    ]
                  },
                  "assigneeUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rotationOrder": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "rotationStrategy": {
                    "type": "string",
                    "enum": [
                      "alternate",
                      "fair"
                    ]
                  },
                  "notifyMode": {
                    "type": "string",
                    "enum": [
                      "assignee",
                      "all"
                    ]
                  },
                  "graceDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "dueSoonDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "tasksDelete",
        "summary": "Delete a task",
        "description": "Removes the task with its completions, preparations and notifications. Archive instead to keep the history.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/complete": {
      "post": {
        "operationId": "tasksComplete",
        "summary": "Mark a task done",
        "description": "Returns the completion and the re-evaluated task. A repeated idempotencyKey returns the first completion with status 200. Browser sessions are attributed as manual (or qr when sent); API tokens by their kind (mcp, ha, otherwise api) and their source field is ignored. Linked spare parts are taken out of stock. With serviceLog the work is also logged on the task's asset (400 for a task without an asset); the entry comes back as serviceLog, and serviceLog.resolvedNoteIds resolves notes of that asset with it (undoing the completion reopens them, except a note that has become a defect meanwhile; another asset's note is a 400 and nothing is completed). The returned task is read after the entry was written, so its openNoteCount is current. A counterValue of a task that counts on a vehicle's odometer is a reading of it: A reading below the one before its date or above the one after it is a 400 on the value field (`counterValue` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "completion": {
                      "$ref": "#/components/schemas/Completion"
                    },
                    "task": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "serviceLog": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ServiceLogEntry"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "completion",
                    "task",
                    "serviceLog"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "occurrenceKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "completedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "qr",
                      "notification"
                    ]
                  },
                  "counterValue": {
                    "type": "number"
                  },
                  "serviceLog": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "default": "maintenance",
                        "type": "string",
                        "enum": [
                          "maintenance",
                          "repair",
                          "installation",
                          "inspection",
                          "replacement",
                          "other"
                        ]
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "descriptionMd": {
                        "type": "string",
                        "maxLength": 50000
                      },
                      "contactId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "costMinor": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100000000000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "resolvedNoteIds": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/skip": {
      "post": {
        "operationId": "tasksSkip",
        "summary": "Skip the current occurrence of a task",
        "description": "Like complete, but recorded as skipped: the next occurrence follows without counting as done.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "completion": {
                      "$ref": "#/components/schemas/Completion"
                    },
                    "task": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "serviceLog": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ServiceLogEntry"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "completion",
                    "task",
                    "serviceLog"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "occurrenceKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "completedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "qr",
                      "notification"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/snooze": {
      "post": {
        "operationId": "tasksSnooze",
        "summary": "Hide a task until a date",
        "description": "until must be after today; null ends the snooze. Snoozed tasks send no notifications.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "until": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "until"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/preparations": {
      "get": {
        "operationId": "preparationsList",
        "summary": "List the preparations of a task",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Preparation"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "preparationsCreate",
        "summary": "Add a preparation to a task",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preparation"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "kind": {
                    "default": "generic",
                    "type": "string",
                    "enum": [
                      "generic",
                      "order_part"
                    ]
                  },
                  "leadDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 3650
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "leadValue": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          "op": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "ne",
                              "gt",
                              "gte",
                              "lt",
                              "lte"
                            ]
                          },
                          "value": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 255
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "entityId",
                          "op",
                          "value"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "partId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "qty": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 999
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/preparations/{prepId}": {
      "patch": {
        "operationId": "preparationsUpdate",
        "summary": "Update a preparation",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "prepId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preparation"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "generic",
                      "order_part"
                    ]
                  },
                  "leadDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 3650
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "leadValue": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          "op": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "ne",
                              "gt",
                              "gte",
                              "lt",
                              "lte"
                            ]
                          },
                          "value": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 255
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "entityId",
                          "op",
                          "value"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "partId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "qty": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 999
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "preparationsDelete",
        "summary": "Delete a preparation",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "prepId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/preparations/{prepId}/complete": {
      "post": {
        "operationId": "preparationsComplete",
        "summary": "Tick off a preparation",
        "description": "For the occurrence the task shows now unless occurrenceKey is given. Repeating it is not an error.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "prepId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preparation"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "occurrenceKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/completions": {
      "get": {
        "operationId": "completionsList",
        "summary": "Recent completions, newest first",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "taskId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "includeRevoked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Completion"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/completions/{id}": {
      "delete": {
        "operationId": "completionsUndo",
        "summary": "Undo a completion",
        "description": "Any household member may undo within 7 days of the completion being recorded; the task goes back to its previous due date. Notes that the service log entry written with the completion had resolved are open again (the entry stays in the log), except a note that has become a defect meanwhile: that stays resolved. Undoing twice is not an error.",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dashboard": {
      "get": {
        "operationId": "dashboard",
        "summary": "Overview for the start page",
        "description": "Overdue, today, this week, later (60 days) and signal-based tasks, relevant preparations and the last completions. openDefects: defects that need attention, by deadline. expiringWarranties: warranties ending within 90 days or ended at most 30 days ago. orderNow: parts to order now (same items as GET /parts/order-now). costsYearToDate: what the year has cost so far, all books together and per book (`byBook`; household currency, entries that count as an expense; the same numbers as GET /costs/summary), without any settlement. balances: where the caller stands across all books (`myBalanceMinor`, recorded payments included; positive means the others owe the caller) and the first three of the payments that would square everybody (`suggestedPaymentCount` says how many there are), read from the same ledger as GET /costs/balances. `balances` is null when they could not be worked out right now (the failure is logged by error name and code); the rest of the dashboard is still answered. budgetAlerts: how many budgets are over their amount (`exceeded`) or from 80 % up (`warning`) this month (monthly budgets) and this year (yearly ones), as `GET /costs/budgets/status` measures them, and the three most urgent in `top` (exceeded before warning, then the higher share used; each with its book, category, period, amount, spent, `percentUsed` and `state`). Household data, the same for every member; all zeros and an empty `top` while every budget is within its amount, and null, like `balances`, when it could not be worked out right now (logged as `dashboard.budget_alerts_failed`).",
        "tags": [
          "dashboard"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stats": {
      "get": {
        "operationId": "stats",
        "summary": "Completions per person and category",
        "description": "By completion date between from and to (default: the last 90 days, at most 800 days).",
        "tags": [
          "dashboard"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stats"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications": {
      "get": {
        "operationId": "notificationsList",
        "summary": "The caller's notifications, unread first",
        "description": "Own and household-wide notifications. Text is a message key plus params, rendered in the reader's language.",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Notification"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications/unread-count": {
      "get": {
        "operationId": "notificationsUnreadCount",
        "summary": "Number of unread notifications",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "count"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications/read-all": {
      "post": {
        "operationId": "notificationsReadAll",
        "summary": "Mark all notifications read",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "updated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications/{id}/read": {
      "post": {
        "operationId": "notificationsRead",
        "summary": "Mark a notification read",
        "description": "Other users' notifications are not visible: 404.",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Notification"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/household": {
      "get": {
        "operationId": "householdGet",
        "summary": "The household's name, settings and time zone",
        "tags": [
          "household"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Household"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "householdUpdate",
        "summary": "Change the household's name, handover date or settings",
        "tags": [
          "household"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "admin"
            ]
          }
        ],
        "x-required-scopes": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Household"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "handoverDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "dueSoonDays": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60
                      },
                      "digestTime": {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      "defectDeadlineMonths": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 120
                      },
                      "integrationHostAllowlist": {
                        "description": "Hosts (`host` or `host:port`, normalised) that members may point their own (per-person) integration connections at. Administrators may use any host. Shown to administrators only.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 260
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/users/directory": {
      "get": {
        "operationId": "usersDirectory",
        "summary": "Names of everyone in the household",
        "description": "Id, display name and ownership share (`ownershipBps`, basis points of the shared costs the person bears; every member can read it from the frozen shares of the cost entries anyway), for assignee pickers, activity lines and split previews. Nothing else about a user. Needs the `read` scope (a token with other scopes only is refused, since the shares are money-related); a browser session has it.",
        "tags": [
          "users"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DirectoryUser"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/users/{id}/revoke-tokens": {
      "post": {
        "operationId": "usersRevokeTokens",
        "summary": "Revoke all of a user's API tokens",
        "description": "Revokes every live API token (mobile, integration, MCP) of the user, e.g. after a leaked token. Browser sessions are not affected. Returns how many tokens were revoked.",
        "tags": [
          "users"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "x-required-scopes": [
          "admin"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts": {
      "get": {
        "operationId": "contactsList",
        "summary": "List contacts",
        "description": "Filter by kind, emergency flag or a search text over name, company, e-mail and phone. Sorted by sort order, then name.",
        "tags": [
          "contacts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "installer",
                "property_mgmt",
                "manufacturer_support",
                "emergency",
                "utility",
                "insurance",
                "neighbor",
                "seller",
                "other"
              ]
            }
          },
          {
            "name": "emergency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contact"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "contactsCreate",
        "summary": "Create a contact",
        "description": "externalSource and externalRef link the contact to a record in another system; the pair is unique.",
        "tags": [
          "contacts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "installer",
                      "property_mgmt",
                      "manufacturer_support",
                      "emergency",
                      "utility",
                      "insurance",
                      "neighbor",
                      "seller",
                      "other"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "company": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "emergency": {
                    "default": false,
                    "type": "boolean"
                  },
                  "guestVisible": {
                    "default": false,
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "externalSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts/{id}": {
      "get": {
        "operationId": "contactsGet",
        "summary": "Get a contact with the assets it is linked to",
        "tags": [
          "contacts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "contactsUpdate",
        "summary": "Update a contact",
        "tags": [
          "contacts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "installer",
                      "property_mgmt",
                      "manufacturer_support",
                      "emergency",
                      "utility",
                      "insurance",
                      "neighbor",
                      "seller",
                      "other"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "company": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "emergency": {
                    "type": "boolean"
                  },
                  "guestVisible": {
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "externalSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "externalRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "contactsDelete",
        "summary": "Delete a contact",
        "description": "Links to assets are removed; service log entries and defects that named the contact keep their text and lose the link.",
        "tags": [
          "contacts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/contacts": {
      "get": {
        "operationId": "assetContactsList",
        "summary": "Contacts linked to an asset",
        "tags": [
          "contacts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssetContact"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetContactsLink",
        "summary": "Link a contact to an asset",
        "description": "A contact can be linked to an asset once per role; repeating it is a conflict.",
        "tags": [
          "contacts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetContact"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "role": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "support",
                      "installer",
                      "seller",
                      "service",
                      "other"
                    ]
                  }
                },
                "required": [
                  "contactId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/contacts/{linkId}": {
      "delete": {
        "operationId": "assetContactsUnlink",
        "summary": "Unlink a contact from an asset",
        "tags": [
          "contacts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/parts": {
      "get": {
        "operationId": "partsList",
        "summary": "List spare parts",
        "description": "Filter by a search text, by linked asset or task, or to parts below their minimum stock. Archived parts are left out unless includeArchived=true.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "taskId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "lowStock",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Part"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "partsCreate",
        "summary": "Create a spare part",
        "description": "A starting stock above zero is booked as a movement. The currency defaults to the household's.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Part"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "partNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplier": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shopUrl": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "unitPriceMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "stockCount": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "minStock": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "reorderQty": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000
                  },
                  "leadTimeDays": {
                    "default": 14,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3650
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/parts/order-now": {
      "get": {
        "operationId": "partsOrderNow",
        "summary": "Parts to order now",
        "description": "For each task with linked parts: the parts whose stock (plus what is on order) does not cover the quantity the task needs plus the minimum stock, once today has reached the order-by date (needed-by date minus the part's lead time). Sorted by order-by date.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OrderNowItem"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/parts/{id}": {
      "get": {
        "operationId": "partsGet",
        "summary": "Get a spare part with its links and recent movements",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "partsUpdate",
        "summary": "Update a spare part",
        "description": "Stock is changed with the stock endpoint, which records a movement.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Part"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "partNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplier": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shopUrl": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "unitPriceMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "minStock": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "reorderQty": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000
                  },
                  "leadTimeDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3650
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "partsDelete",
        "summary": "Delete a spare part",
        "description": "Links to assets and tasks and the movement history go with it; preparations that named the part lose the link. Archive to keep the history.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/parts/{id}/stock": {
      "post": {
        "operationId": "partsStock",
        "summary": "Book a stock movement",
        "description": "`used` takes stock out (negative delta), `bought` brings it in (positive delta) and ends a pending order, `correction` does either. Stock cannot go below zero. Completing a task that has the part linked books a `used` movement by itself.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Part"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delta": {
                    "type": "integer",
                    "minimum": -100000,
                    "maximum": 100000
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "used",
                      "bought",
                      "correction"
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "delta",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/parts/{id}/movements": {
      "get": {
        "operationId": "partsMovements",
        "summary": "Stock movements of a part, newest first",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PartMovement"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/parts/{id}/ordered": {
      "post": {
        "operationId": "partsOrdered",
        "summary": "Mark a part as ordered",
        "description": "Records the order time and quantity (default: the reorder quantity); qty 0 clears the order. Booking the stock as bought clears it too.",
        "tags": [
          "parts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Part"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "qty": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/parts": {
      "get": {
        "operationId": "assetPartsList",
        "summary": "Spare parts of an asset",
        "tags": [
          "parts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssetPart"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetPartsLink",
        "summary": "Link a spare part to an asset",
        "tags": [
          "parts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetPart"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "partId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "partId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/parts/{partId}": {
      "delete": {
        "operationId": "assetPartsUnlink",
        "summary": "Unlink a spare part from an asset",
        "tags": [
          "parts",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "partId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/parts": {
      "get": {
        "operationId": "taskPartsList",
        "summary": "Spare parts a task uses",
        "tags": [
          "parts",
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaskPart"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "taskPartsLink",
        "summary": "Link a spare part to a task",
        "description": "Completing the task takes qty of the part out of stock; undoing the completion puts it back.",
        "tags": [
          "parts",
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskPart"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "partId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "qty": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 999
                  }
                },
                "required": [
                  "partId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{id}/parts/{partId}": {
      "patch": {
        "operationId": "taskPartsUpdate",
        "summary": "Change the quantity a task uses",
        "tags": [
          "parts",
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "partId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskPart"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "qty": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 999
                  }
                },
                "required": [
                  "qty"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "taskPartsUnlink",
        "summary": "Unlink a spare part from a task",
        "tags": [
          "parts",
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "partId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/service-log": {
      "get": {
        "operationId": "serviceLogList",
        "summary": "Recent service log entries across all assets",
        "description": "Newest first; filter by asset, kind or a date range.",
        "tags": [
          "service-log"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "maintenance",
                "repair",
                "installation",
                "inspection",
                "replacement",
                "other"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ServiceLogEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/service-log": {
      "get": {
        "operationId": "assetServiceLogList",
        "summary": "Service log of an asset, newest first",
        "tags": [
          "service-log",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "maintenance",
                "repair",
                "installation",
                "inspection",
                "replacement",
                "other"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ServiceLogEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetServiceLogCreate",
        "summary": "Add a service log entry",
        "description": "resolvedNoteIds: notes of this asset (see /assets/{id}/notes) the work addressed. They become resolved with this entry; another asset's note or an unknown id is a 400 and nothing is written. A vehicle's odometer value is a reading of it: A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem.",
        "tags": [
          "service-log",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceLogEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "kind": {
                    "default": "maintenance",
                    "type": "string",
                    "enum": [
                      "maintenance",
                      "repair",
                      "installation",
                      "inspection",
                      "replacement",
                      "other"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "default": "",
                    "type": "string",
                    "maxLength": 50000
                  },
                  "contactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "costMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "odometer": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "performedBy": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resolvedNoteIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/service-log/{entryId}": {
      "get": {
        "operationId": "assetServiceLogGet",
        "summary": "Get a service log entry",
        "tags": [
          "service-log",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceLogEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "assetServiceLogUpdate",
        "summary": "Update a service log entry",
        "description": "resolvedNoteIds adds notes of this asset to those the entry resolved (open ones become resolved with it, resolved ones stay as they are); it can be the only field. Notes are reopened by changing the note, deleting the entry or undoing the completion the entry was written with; a note that has become a defect stays resolved when the entry goes. A vehicle's odometer value is a reading of it: A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem.",
        "tags": [
          "service-log",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceLogEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "maintenance",
                      "repair",
                      "installation",
                      "inspection",
                      "replacement",
                      "other"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "contactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "costMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "odometer": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "performedBy": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resolvedNoteIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "assetServiceLogDelete",
        "summary": "Delete a service log entry",
        "description": "The notes the entry had resolved are open again, except a note that has become a defect meanwhile (it stays resolved); its attachments and comments go with it.",
        "tags": [
          "service-log",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/vehicle": {
      "get": {
        "operationId": "vehiclesGet",
        "summary": "Details of a vehicle",
        "description": "Plate, VIN, registration data, tire sizes, where it is kept and the newest odometer reading. A vehicle whose details were never saved answers with empty ones (and kilometres). Only a vehicle has this: 404 `not_found` for an asset of another kind, as for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vehicle"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "vehiclesPut",
        "summary": "Save the details of a vehicle",
        "description": "Replaces the details: a field left out is cleared and the odometer unit goes back to km. Changing the unit relabels the readings, it does not convert them. `costBookId` is the cost book the fuel fills of the vehicle are booked into when a fill names none (an open book, else 400 on `costBookId`; omitted it is cleared like every other field). Only a vehicle can take this: 400 `invalid_request` for an asset of another kind, 404 `not_found` for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vehicle"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "vin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "registrationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "firstRegistration": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fuelType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "petrol",
                          "diesel",
                          "electric",
                          "hybrid",
                          "plugin_hybrid",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tireSizeSummer": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tireSizeWinter": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "location": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "odometerUnit": {
                    "type": "string",
                    "enum": [
                      "km",
                      "mi"
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "costBookId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/vehicle/stats": {
      "get": {
        "operationId": "vehicleStats",
        "summary": "A vehicle in numbers",
        "description": "For a year (year=) or for all time: distance driven (from the odometer readings, per month too), the cost entries of the vehicle that count as an expense in the household currency by category and per distance unit, the average and the last ten consumption values (full-to-full) per unit, the price per unit of the fuel, the mounted tire set and the next tasks of the vehicle. Only a vehicle has this: 404 `not_found` for an asset of another kind, as for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VehicleStats"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/fuel-logs": {
      "get": {
        "operationId": "fuelLogsList",
        "summary": "Fuel log (Tankbuch) of a vehicle, newest first",
        "description": "Every fill-up or charge with its price per unit and, on a full fill that closes a stretch, the distance since the previous full fill, the consumption per 100 and the cost per distance (full-to-full method: partial fills in between are added up, a fill flagged missedPrevious starts the chain again, litres and kWh are counted apart). Filter by year. Only a vehicle has this: 404 `not_found` for an asset of another kind, as for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1900,
              "maximum": 2999
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FuelLog"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "fuelLogsCreate",
        "summary": "Log a fill-up or charge",
        "description": "In one transaction: the odometer becomes a reading of the vehicle (source fuel_log; a value lower than the reading before is a 400 on odometer) and, unless amountMinor is 0, a cost entry of the category fuel is booked for the vehicle (title like \"Tanken <station>\", paid by paidByUserId, default the caller, split by splitMode, default the split of its book). The book is bookId (an open book, else 400 on bookId), else the vehicle's own book (costBookId of its details, while that book is open), else the default book. The cost entry is the fuel log entry's own: its amount, currency and date change through PATCH /fuel-logs/{id} only, and its device stays the vehicle. It needs costs:write because it books money. `receiptTaskId` books the fill for a task of the receipt queue: its cost entry is flagged `reviewNeeded` and recorded on the task (`bookedSoFar`), as for `POST /costs` (400 on the field for an unknown task or a free fill, which has no cost entry; 409 for a task that is not waiting any more). A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem. Only a vehicle can take this: 400 `invalid_request` for an asset of another kind, 404 `not_found` for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FuelLog"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "odometer": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "quantity": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 10000
                  },
                  "unit": {
                    "type": "string",
                    "enum": [
                      "l",
                      "kWh"
                    ]
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "fullTank": {
                    "default": true,
                    "type": "boolean"
                  },
                  "missedPrevious": {
                    "default": false,
                    "type": "boolean"
                  },
                  "station": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "receiptTaskId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "odometer",
                  "quantity",
                  "amountMinor"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/fuel-logs/{id}": {
      "get": {
        "operationId": "fuelLogsGet",
        "summary": "A fuel log entry",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FuelLog"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "fuelLogsUpdate",
        "summary": "Change a fuel log entry",
        "description": "The reading follows the date and the odometer; the cost entry follows the amount, currency, date, station, payer, split and book (`bookId` moves it to another open book; a tax class is reset when the book is not tax relevant, as for any move). The fuel log entry owns the amount, currency and date of its cost entry: they change here only (`PATCH /costs/{id}` refuses other values, and any other device, with 409 `conflict`, `details.fuelLogId`; the cost entry's `fuelLogId` points back). A change of station or unit rewrites the cost entry's title and payee only while each still is what this entry wrote there last time, so a title or payee edited on the cost entry stays. An entry made free loses its cost entry, one that costs something now and has none gets one. A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem.",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FuelLog"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "odometer": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "quantity": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 10000
                  },
                  "unit": {
                    "type": "string",
                    "enum": [
                      "l",
                      "kWh"
                    ]
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "fullTank": {
                    "type": "boolean"
                  },
                  "missedPrevious": {
                    "type": "boolean"
                  },
                  "station": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "fuelLogsDelete",
        "summary": "Delete a fuel log entry",
        "description": "The odometer reading it wrote and the cost entry it booked are deleted with it (receipts attached to that cost entry too); the cost entry cannot be deleted on its own (`DELETE /costs/{id}` is a 409 `conflict`, `details.fuelLogId`).",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/tire-sets": {
      "get": {
        "operationId": "tireSetsList",
        "summary": "Tire sets of a vehicle",
        "description": "The mounted set first, then by season; retired sets only with includeRetired=true. Each set carries the distance driven on it, a treadWarning (below 3 mm for summer, 4 mm for winter and all-season) and its age from the DOT code. Only a vehicle has this: 404 `not_found` for an asset of another kind, as for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "includeRetired",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TireSet"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "tireSetsCreate",
        "summary": "Add a tire set to a vehicle",
        "description": "The set is not mounted; mount it with the mount endpoint. Only a vehicle can take this: 400 `invalid_request` for an asset of another kind, 404 `not_found` for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TireSetDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "season": {
                    "type": "string",
                    "enum": [
                      "summer",
                      "winter",
                      "all_season"
                    ]
                  },
                  "brand": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "size": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dot": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "treadDepthMm": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "treadMeasuredOn": {
                    "type": "string",
                    "format": "date"
                  },
                  "storageLocation": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "storageContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purchasedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "season"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tire-sets/{id}": {
      "get": {
        "operationId": "tireSetsGet",
        "summary": "A tire set with its mount and measurement history",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TireSetDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "tireSetsUpdate",
        "summary": "Change or retire a tire set",
        "description": "Whether the set is mounted and its tread depth change through the mount and tread endpoints only. retired: true takes a mounted set off first.",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TireSetDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "season": {
                    "type": "string",
                    "enum": [
                      "summer",
                      "winter",
                      "all_season"
                    ]
                  },
                  "brand": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "size": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dot": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "storageLocation": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "storageContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purchasedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "retired": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "tireSetsDelete",
        "summary": "Delete a tire set",
        "description": "Its events, the odometer readings they wrote and its attachments go with it. Retire the set instead to keep its history.",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/tire-sets/{setId}/mount": {
      "post": {
        "operationId": "tireSetsMount",
        "summary": "Mount a tire set",
        "description": "Takes the mounted set off (an unmounted event of the same day) and mounts this one. With an odometer value the vehicle gets that reading (source tire_change). A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem. Nothing is changed when the odometer value is refused or when the date is before the day the set that would be taken off was mounted (400 on `date`; the same day is fine). 409 for a retired set and for one that is already mounted. Only a vehicle can take this: 400 `invalid_request` for an asset of another kind, 404 `not_found` for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "setId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TireSetDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "odometer": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/tire-sets/{id}/tread": {
      "post": {
        "operationId": "tireSetsTread",
        "summary": "Record a tread depth measurement",
        "description": "Adds a measurement event; the newest measurement is the set's current depth. With an odometer value the vehicle gets that reading as well. A reading below the one before its date or above the one after it is a 400 on the value field (`odometer` here) whose `details` carry `code` (`lower_than_previous` or `higher_than_next`), `field` and `reading` (`{value, date}` of the neighbouring reading in the way) besides the English field error; no such code for any other problem.",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TireSetDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "treadDepthMm": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "odometer": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000
                  }
                },
                "required": [
                  "treadDepthMm"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/odometer": {
      "get": {
        "operationId": "odometerList",
        "summary": "Odometer readings of a vehicle, newest first",
        "description": "Every reading ever recorded, by date and then by when it was entered. Readings are never pruned. Only a vehicle has this: 404 `not_found` for an asset of another kind, as for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OdometerReading"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "odometerCreate",
        "summary": "Record an odometer reading",
        "description": "The date defaults to today and must not be in the future. A value lower than the reading before it or higher than the reading after it (by date) is a 400 on `value` with `details.code` `lower_than_previous` or `higher_than_next`, `details.field` and `details.reading` (`{value, date}` of the reading in the way), unless `force` is true (a replaced instrument cluster). The newest reading becomes the signal `odometer:<asset id>` that tasks with a counter trigger read, so due dates, estimates and notifications follow at once. Only a vehicle can take this: 400 `invalid_request` for an asset of another kind, 404 `not_found` for a missing asset.",
        "tags": [
          "vehicles",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OdometerReading"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "value": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/odometer-readings/{id}": {
      "delete": {
        "operationId": "odometerDelete",
        "summary": "Delete an odometer reading",
        "description": "Deletes a reading a person typed in; the vehicle's newest remaining reading becomes its current one. A reading written for a completion, a service log entry, a fuel log entry or a tire change belongs to that record and goes when the record is changed or deleted: deleting it here is a 409 `conflict` that names the owner (`details.source`, `details.sourceId`). A reading whose record no longer exists is free and can be deleted.",
        "tags": [
          "vehicles"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs": {
      "get": {
        "operationId": "costsList",
        "summary": "List cost entries",
        "description": "Newest first by date. Filter by book (`bookId`; an unknown book is a 404, not an empty list), year or a date range (`from`/`to`), category, asset, room, defect, who paid (`paidBy`, a user id or `me`), whether a person still has to review the entry (`reviewNeeded=true|false`), the tag it carries (`tagId`; an unknown tag is a 404) and a search text over title, payee and notes. Amounts are minor units of the entry's currency: positive = expense, negative = refund. Every entry carries its book and whether that book is tax relevant (`bookTaxRelevant`) and its tags.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "repair",
                "utilities",
                "renewal_fund",
                "purchase",
                "mortgage_interest",
                "mortgage_principal",
                "insurance",
                "renovation",
                "maintenance",
                "fuel",
                "taxes_fees",
                "groceries",
                "household",
                "dining",
                "leisure",
                "travel",
                "health",
                "gifts",
                "transport",
                "subscriptions",
                "other"
              ]
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "defectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "paidBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "tagId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "reviewNeeded",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CostEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "costsCreate",
        "summary": "Book a cost",
        "description": "`bookId` defaults to the default book (`isDefault` in `GET /cost-books`; an archived book is a 400 on `bookId`), `currency` to the household's, `date` to today. `splitMode` defaults to the book's default split: `ownership` divides by the people's current ownership shares, `equal` equally among everybody or, with `participantIds`, among those household members only (each listed once), `custom` by `shares` (basis points, sum 10000), `none` does not split; `participantIds` with any other split and `shares` with any other than `custom` are a 400. The shares are frozen with the entry; the parts add up to the amount exactly (largest remainder, ties to the earlier user id). `countsAsExpense` defaults to false for a mortgage repayment (equity), else true. `deductible` other than `unknown` needs a tax relevant book (400 on `deductible` otherwise). `tagIds` label the entry with tags (`/cost-tags`; 400 on `tagIds` for one that does not exist). A finance provider's transaction is booked by accepting its suggestion; `financeSuggestionId` instead ties an entry you book by hand to one of your own pending cost suggestions from the finance app (`GET /finance/matches` finds them): in the same transaction the suggestion is accepted and the entry remembers the transaction, so it is never booked twice and its back-link is written (404 for a suggestion that is not yours, 400 on the field when it is not a cost or its amount or currency differs from the entry's, 409 when it is decided already). Without `financeSuggestionId`, when exactly one of the payer's pending cost suggestions looks like the new entry (same amount and currency, at most 3 days apart, similar text) it becomes a `link` suggestion to this entry in the same transaction (a recurring booking does the same); nothing is accepted by itself, and several fitting suggestions change nothing. `receiptTaskId` books the entry for a task of the receipt queue (`/ai-tasks`): in the same transaction the entry is flagged `reviewNeeded` and recorded on the task (`bookedSoFar` of `GET /ai-tasks/{id}`, `receiptTaskId` on the entry), so an interrupted client or another one sees what is booked already; an unknown task is a 400 on the field, a task that is done or dismissed a 409 `conflict` (`details.status`). A repeated `idempotencyKey` (8 to 128 characters; unique per person who books, whatever credential they use) returns the first entry with status 200 and books nothing; the same key for a different entry (amount, currency, category, title or receipt task, or book, date or payer when the retry names them) is a 409 `conflict`; once the entry is deleted its key is free again. Send one per attempt to save, and keep it for a retry that got no answer. A 409 `conflict` carries `details.code` so a client does not have to guess: `idempotency_key_reused` (the key stands for another entry), `suggestion_decided` (the suggestion named by `financeSuggestionId` was accepted or dismissed already, or its transaction is booked) or `receipt_task_closed` (the receipt task is not waiting any more; `details.status`). A refused request books nothing and spends no key.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": -100000000000,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serviceLogId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payee": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 4000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "participantIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "countsAsExpense": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "default": "unknown",
                    "type": "string",
                    "enum": [
                      "unknown",
                      "maintenance",
                      "investment",
                      "no"
                    ]
                  },
                  "tagIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "financeSuggestionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "receiptTaskId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  }
                },
                "required": [
                  "title",
                  "amountMinor",
                  "category"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/summary": {
      "get": {
        "operationId": "costsSummary",
        "summary": "Costs of a year: totals and settlement",
        "description": "Totals per category, month and asset (top ten) and per tax class count entries in the household currency that count as an expense; mortgage repayments are reported as `equityTotalMinor`; the tax classes count the entries of tax relevant books only. `people` and `settlement` cover every split entry with a payer of the year: `balanceMinor` = paid - share, and `settlement` lists who pays whom to square the balances. Recorded payments (`/settlements`) are not part of a year: the running balance with them is `GET /costs/balances`. With `assetId`, `bookId` or `tagId` only the entries of that asset, book or tag are counted; a `bookId` or `tagId` that names nothing is a 404.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "tagId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostsSummary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/recent-categories": {
      "get": {
        "operationId": "costsRecentCategories",
        "summary": "The categories the newest entries used",
        "description": "How often each category was used by the newest 100 entries of each book (`entriesPerBook`), as rows `{bookId, category, count}` per book in the order of the books, most used first: what a form needs to offer the likely categories first without reading whole entries. Every entry counts, refunds and other currencies too; archived books are included. With `bookId` only that book is answered (a book that does not exist is a 404). Read scope.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecentCategories"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/move-to-book": {
      "post": {
        "operationId": "costsMoveToBook",
        "summary": "Move cost entries to another book",
        "description": "Moves the entries in `ids` (1 to 500) or every entry of the device `assetId` into the book `bookId`, all or nothing in one transaction; give exactly one of `ids` and `assetId` (400 on `ids` otherwise). The book must be open (400 on `bookId` for an unknown or archived one), an unknown id is a 400 on `ids` and nothing moves, an unknown device a 400 on `assetId`. Entries already in the book are counted as `unchanged`. An entry keeps its split, payer and frozen shares: moving changes which ledger it counts in (summaries, balances, the book's CSV), not who bears it. Entries booked by a fuel log entry move too (the fill owns their amount, currency, date and device only). Moving into a book that is not tax relevant resets a tax class other than `unknown` to `unknown` (`deductibleReset` counts them). With `dryRun: true` nothing is written: the same checks and the same numbers come back with `dryRun: true`, `moved` and `deductibleReset` saying what a move would do and `years` the first and last year of the dates of the entries that would move (null when none would), so a client can show \"23 entries from 2024-2026, 5 lose their tax class\" before the person confirms. A real move answers `dryRun: false` and the same `years` of what it moved.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MoveCostsToBookResult"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "ids": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "assetId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "dryRun": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "bookId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/export.csv": {
      "get": {
        "operationId": "costsExport",
        "summary": "Cost entries of a year as CSV",
        "description": "UTF-8 with a byte order mark, semicolon separated and CRLF line ends (opens in Swiss Excel). Amounts are plain decimals with a point and no thousands separator (`-12.50`), so they parse the same everywhere. Text that would be read as a formula is prefixed with an apostrophe. Columns are only ever added at the end (`tags` is the last one: the tag names of the entry, by name, separated by a comma and a space). With `bookId` or `tagId` only that book's or tag's entries are exported (404 for one that does not exist).",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          },
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "tagId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/{id}": {
      "get": {
        "operationId": "costsGet",
        "summary": "Get a cost entry",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "costsUpdate",
        "summary": "Change a cost entry",
        "description": "Setting `splitMode` to `ownership` or `equal` splits again by the people's current shares (`equal` among everybody); `shares` need `custom`; `participantIds` need an `equal` split (the entry's, or the one set in the same request) and split again among those members. Changing only the amount keeps the frozen shares. `tagIds` replaces the entry's tags (an empty list removes them all). `financeSuggestionId` ties the entry to one of your own pending cost suggestions from the finance app as when booking (checked against the amount and currency the entry has after the change; 409 for an entry that is tied to a finance item already, unless it is that very suggestion, which changes nothing). `bookId` moves the entry to another book that is not archived (an entry may stay in an archived book); moving it to a book that is not tax relevant resets its `deductible` to `unknown` unless the request sets it, and `deductible` other than `unknown` (and other than the entry's own) is a 400 there. An entry booked from a finance provider keeps its source; its back-link in the provider is refreshed. An entry a fuel log entry booked (`fuelLogId` is set) keeps its amount, currency, date and device as that entry has them: asking for other values is a 409 `conflict` with `details.fuelLogId` (the first three change with `PATCH /fuel-logs/{id}`, the device is the vehicle and stays); sending the current values is fine, and category, title, notes, payee, payer, split, deductibility, room, defect and service log entry stay editable here. A 409 about the finance link carries `details.code`: `entry_tied` (the entry is tied to a finance item already) or `suggestion_decided` (the suggestion named by `financeSuggestionId` is decided already); the fuel log lock has `details.fuelLogId` instead.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": -100000000000,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serviceLogId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payee": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 4000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "participantIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "countsAsExpense": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "maintenance",
                      "investment",
                      "no"
                    ]
                  },
                  "tagIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "financeSuggestionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "costsDelete",
        "summary": "Delete a cost entry",
        "description": "Removes the entry with its comments and attachments, and its back-link in the finance provider. A transaction booked from a provider is not offered again. An entry a fuel log entry booked (`fuelLogId` is set) goes with that entry: 409 `conflict` with `details.fuelLogId`, delete it with `DELETE /fuel-logs/{id}`.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/{id}/review": {
      "post": {
        "operationId": "costsReview",
        "summary": "Mark a cost entry as reviewed",
        "description": "Clears `reviewNeeded` and records who looked at the entry and when (`reviewedByUserId`, `reviewedAt`). Entries booked from a receipt in the receipt queue (`/ai-tasks`) are flagged until somebody does this. Reviewing an entry nobody has to review changes nothing and answers 200 with the entry as it is (the first reviewer stays), so a retry is harmless. No request body.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/balances": {
      "get": {
        "operationId": "costsBalances",
        "summary": "Where everybody stands: running balances and suggested payments",
        "description": "All-time balance per household member: paid - share over the split entries with a payer, plus the payments they made (settlements) minus those they received; positive means the others owe this person. Pass `bookId` for one book (its settlements only; payments across all books cannot be attributed and stay out) or `all=true` for every book together, archived ones and payments across all books included; without parameters all books are used. A book together with `all=true`, or `all=false` without a book, is a 400; an unknown `bookId` is a 404. In the view of one book `crossBookSettlements` says how many recorded payments across all books (and for how much, household currency) the view leaves out; in the view of all books it is null. Only the household currency is counted (`otherCurrencyCount` says how many entries and payments were left out). `suggestedPayments` are the fewest payments that square the balances. The per-year settlement in `GET /costs/summary` is separate and does not include recorded payments.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "all",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBalances"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-books": {
      "get": {
        "operationId": "costBooksList",
        "summary": "List cost books",
        "description": "The ledgers entries are booked into (by default `Wohnung`, `Haushalt` and `Auto`). Active books by sort order; archived ones only with `includeArchived=true`, after the active ones. `isDefault` marks the book an entry without `bookId` goes to: exactly one book has it, never an archived one, and reordering the books does not move it.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CostBook"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "costBooksCreate",
        "summary": "Create a cost book",
        "description": "`slug` is derived from the name, `defaultSplitMode` is `ownership` (or `equal`, `none`), `taxRelevant` false (only a tax relevant book takes a `deductible` class on its entries) and the book goes to the end of the list. `isDefault: true` makes it the default book (the previous one stops being it). Names are unique without regard to case, umlauts included (409 `conflict`).",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBook"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "icon": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultSplitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "none"
                    ]
                  },
                  "taxRelevant": {
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "isDefault": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-books/{id}": {
      "get": {
        "operationId": "costBooksGet",
        "summary": "Get a cost book",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBook"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "costBooksUpdate",
        "summary": "Change, archive or restore a cost book",
        "description": "`archived` archives (closed to new entries; its entries and payments stay and still count in the balances) or restores. The last book that is not archived cannot be archived (409 `conflict`). `isDefault: true` makes the book the default in the same step the previous default loses it (400 on `isDefault` for an archived book that stays archived; restore and default may be sent together); `isDefault: false` on the default book is a 409, name another default instead. Archiving the default book hands the default to the first book that is still open (by sort order); restoring a book never makes it the default. Switching `taxRelevant` off keeps what its entries say about their tax class; it stays out of the tax breakdown.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBook"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "icon": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultSplitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "none"
                    ]
                  },
                  "taxRelevant": {
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "archived": {
                    "type": "boolean"
                  },
                  "isDefault": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "costBooksDelete",
        "summary": "Delete an empty cost book",
        "description": "Only a book without entries, payments and recurring costs can be deleted; otherwise 409 `conflict` with `details.entryCount` and `details.settlementCount` (or `details.recurrenceCount`): archive it instead. The last book that is not archived cannot be deleted either. Deleting the default book hands the default to the first book that is still open. The book's budgets go with it.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-tags": {
      "get": {
        "operationId": "costTagsList",
        "summary": "List cost tags",
        "description": "The labels cost entries carry, by name without regard to case, with the number of entries that carry each. Not paged: there are at most 200.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CostTag"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "costTagsCreate",
        "summary": "Create a cost tag",
        "description": "`color` is a key the client maps to a colour and defaults to `gray`. Names are unique without regard to case, umlauts included (409 `conflict`), and there are at most 200 tags (409).",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostTag"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "color": {
                    "type": "string",
                    "enum": [
                      "gray",
                      "red",
                      "orange",
                      "amber",
                      "green",
                      "teal",
                      "blue",
                      "violet",
                      "pink"
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-tags/{id}": {
      "get": {
        "operationId": "costTagsGet",
        "summary": "Get a cost tag",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostTag"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "costTagsUpdate",
        "summary": "Rename or recolour a cost tag",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostTag"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "color": {
                    "type": "string",
                    "enum": [
                      "gray",
                      "red",
                      "orange",
                      "amber",
                      "green",
                      "teal",
                      "blue",
                      "violet",
                      "pink"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "costTagsDelete",
        "summary": "Delete a cost tag",
        "description": "The entries (and recurring costs) that carried the tag stay, without it.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-budgets": {
      "get": {
        "operationId": "costBudgetsList",
        "summary": "List cost budgets",
        "description": "What the household wants to spend in a book, a category or both, per calendar month or year, in the order the budgets were made; inactive ones included. Where they stand is `GET /costs/budgets/status`.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CostBudget"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "costBudgetsCreate",
        "summary": "Set a cost budget",
        "description": "For a book (`bookId`), a category (`category`) or both (400 on `bookId` when it names neither), per `month` or `year`, in the household currency of the day. One budget per book, category and period (409 `conflict`). Deleting a book deletes its budgets.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBudget"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "repair",
                          "utilities",
                          "renewal_fund",
                          "purchase",
                          "mortgage_interest",
                          "mortgage_principal",
                          "insurance",
                          "renovation",
                          "maintenance",
                          "fuel",
                          "taxes_fees",
                          "groceries",
                          "household",
                          "dining",
                          "leisure",
                          "travel",
                          "health",
                          "gifts",
                          "transport",
                          "subscriptions",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "month",
                      "year"
                    ]
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "period",
                  "amountMinor"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/costs/budgets/status": {
      "get": {
        "operationId": "costBudgetsStatus",
        "summary": "Where the active budgets stand",
        "description": "For every active budget: what the entries in its scope add up to (entries that count as an expense, refunds netted off, in the budget's currency) in the month `year`/`month` for a monthly budget or in the whole `year` for a yearly one, what is left, the whole percent used and a `state`: `ok`, `warning` from 80 % (`warningPercent`) or `exceeded` from 100 %. `year` and `month` default to today in the household zone, each on its own. Nothing is announced by a notification; a client shows the state.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBudgetStatus"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-budgets/{id}": {
      "get": {
        "operationId": "costBudgetsGet",
        "summary": "Get a cost budget",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBudget"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "costBudgetsUpdate",
        "summary": "Change a cost budget",
        "description": "`null` for `bookId` or `category` removes that half of the scope; what is left must name a book or a category (400 on `bookId`). `active: false` keeps the budget but leaves it out of the status. A change that makes it the same as another budget is a 409.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostBudget"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "repair",
                          "utilities",
                          "renewal_fund",
                          "purchase",
                          "mortgage_interest",
                          "mortgage_principal",
                          "insurance",
                          "renovation",
                          "maintenance",
                          "fuel",
                          "taxes_fees",
                          "groceries",
                          "household",
                          "dining",
                          "leisure",
                          "travel",
                          "health",
                          "gifts",
                          "transport",
                          "subscriptions",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "month",
                      "year"
                    ]
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "costBudgetsDelete",
        "summary": "Delete a cost budget",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-recurrences": {
      "get": {
        "operationId": "costRecurrencesList",
        "summary": "List recurring costs",
        "description": "The costs that repeat (rent, insurance, a subscription): the ones that book first, soonest `nextDate` first, then the paused and finished ones by title. `active=true` lists the ones that book, `active=false` the paused and finished ones; `bookId` narrows to one book. Not paged: there are at most 200.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CostRecurrence"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "costRecurrencesCreate",
        "summary": "Set up a recurring cost",
        "description": "The template of an entry (the fields of `POST /costs` without a date) and a rule: every `interval` months (`monthly`), quarters or years, counted from the month of `startDate`, on `dayOfMonth` (default: the day of `startDate`; a day a shorter month does not have means its last day, so 31 gives 31 January, 28 February, 31 March). The first occurrence is the first one on or after `startDate`; `endDate` (included) closes the series. The template is checked as booking would be (400 on the field for an unknown book, asset, room, payer or tag, a book that is archived, a split that does not fit, a tax class in a book without one; 400 on `endDate` when it leaves no occurrence). A scheduler books each occurrence that falls due, on its date in the household time zone, as an entry with `source: recurring`, `recurrenceId` set and no review flag; an occurrence is booked once even if the run is repeated, and a server that was down books each occurrence it missed. A `startDate` in the past is therefore booked right away, up to 120 occurrences per call. The split is worked out when an entry is booked, so a changed ownership share applies to later entries only.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostRecurrence"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": -100000000000,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payee": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 4000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "participantIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "tagIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "countsAsExpense": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "default": "unknown",
                    "type": "string",
                    "enum": [
                      "unknown",
                      "maintenance",
                      "investment",
                      "no"
                    ]
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "yearly"
                    ]
                  },
                  "interval": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "dayOfMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "title",
                  "amountMinor",
                  "category",
                  "frequency",
                  "startDate"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-recurrences/{id}": {
      "get": {
        "operationId": "costRecurrencesGet",
        "summary": "Get a recurring cost",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostRecurrence"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "costRecurrencesUpdate",
        "summary": "Change, pause or resume a recurring cost",
        "description": "Changes the template for the entries booked from now on (the ones booked already stay as they are) and the rule. After a change of the rule the series continues after the newest occurrence that was booked. `active: false` pauses it; `active: true` on a paused one resumes it at the first occurrence on or after today, skipping what fell due meanwhile. Touching the template asks for an open book (400 on `bookId` for an archived one: move it to another); pausing or changing only the rule does not. `splitMode` `equal` without `participantIds` splits among everybody again, also for a template that was narrowed to some people. A tax class (`deductible`) means something in a tax relevant book only: moving the template to a book that is not tax relevant resets it to `unknown` unless the request sets it, and a class other than `unknown` (and other than the template's own) is a 400 on `deductible` there; entries booked from a template whose book lost its tax class get `unknown`. A new `category` brings the default of `countsAsExpense` along unless the template's value was set on purpose or the request names it, as for an entry. Occurrences already due after the change are booked right away. Any change clears `lastError`.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostRecurrence"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": -100000000000,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payee": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 4000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "participantIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "tagIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "countsAsExpense": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "maintenance",
                      "investment",
                      "no"
                    ]
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "yearly"
                    ]
                  },
                  "interval": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "dayOfMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "costRecurrencesDelete",
        "summary": "Delete a recurring cost",
        "description": "The entries it booked stay (with `source: recurring`, but no longer tied to it: `recurrenceId` becomes null).",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cost-recurrences/{id}/run-now": {
      "post": {
        "operationId": "costRecurrencesRun",
        "summary": "Book the next due occurrence now",
        "description": "Books the next occurrence if it is due (on or before today in the household time zone), exactly one, so a series that is behind needs several calls; `entry` is the new entry. Nothing is booked, and `entry` is null, for a paused or finished recurring cost or one whose next occurrence is still ahead. A booking that fails (the book is archived: 400 on `bookId`) is also recorded as `lastError`. No request body.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostRecurrenceRun"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/settlements": {
      "get": {
        "operationId": "settlementsList",
        "summary": "List recorded payments between the people",
        "description": "Newest first by date. Filter by book (`bookId`; payments across all books are not listed then; a book that does not exist is a 404, not an empty list), year or a date range, and by a person who made or received them (`userId`, a user id or `me`).",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "bookId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2200
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Settlement"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "settlementsCreate",
        "summary": "Record a payment between two people",
        "description": "\"Ben paid Anna 50\": `fromUserId` handed `amountMinor` over to `toUserId`. It is not a cost (no expense total counts it); it moves the balances in `GET /costs/balances`. `bookId` omitted or null settles across all books; a book may be archived (paying back a closed trip is the normal order). `currency` defaults to the household's, `date` to today. The two people must differ and be household members (400 on the field otherwise). A repeated `idempotencyKey` (unique per person who records, whatever credential they use) returns the first payment with status 200 and records nothing; the same key for a different payment (other people, amount, currency or book) is a 409 `conflict` with `details.code` `idempotency_key_reused`; once the payment is deleted its key is free again.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settlement"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fromUserId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "toUserId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  }
                },
                "required": [
                  "fromUserId",
                  "toUserId",
                  "amountMinor"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/settlements/{id}": {
      "get": {
        "operationId": "settlementsGet",
        "summary": "Get a recorded payment",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settlement"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "settlementsUpdate",
        "summary": "Change a recorded payment",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settlement"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bookId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fromUserId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "toUserId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "settlementsDelete",
        "summary": "Delete a recorded payment",
        "description": "The balances move back: the payment counts as never made.",
        "tags": [
          "costs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/finance/suggestions": {
      "get": {
        "operationId": "financeSuggestionsList",
        "summary": "Your suggestions from the connected finance app",
        "description": "Costs, assets, bill tasks and links the finance provider offers, waiting for a decision (`status` defaults to `pending`). A `link` is a transaction that looks like a cost entry somebody booked by hand (same amount and currency, booked at most 3 days from the entry's date, similar payee or title, paid by you, not tied to a finance item yet; found when the transaction is offered or, when the transaction was waiting as a cost already, when such an entry is booked later): its payload carries the `entryId`, the `entry` as it is now (null if it was deleted) and the `transaction`. Accepting it ties the entry to the transaction instead of booking a second entry; dismissing it offers the transaction as a normal cost suggestion. Strictly your own: no other member sees them, and other members' suggestions are never listed or reachable by id.",
        "tags": [
          "finance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "cost",
                "bill_task",
                "asset",
                "link"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pending",
              "type": "string",
              "enum": [
                "pending",
                "accepted",
                "dismissed"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FinanceSuggestion"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/finance/suggestions/{id}/accept": {
      "post": {
        "operationId": "financeSuggestionsAccept",
        "summary": "Accept a suggestion",
        "description": "Creates the cost entry (paid by you, in the book the body names with `bookId`, else the one offered with the suggestion (`payload.bookId`, set by the connection's settings) while it is open, else the default book; split as that book says unless the body says otherwise), the asset or the bill task. The body may override book, category, title, split (`participantIds` narrow an equal split), asset link and so on; fields of another kind are a 400. `tagIds` (a cost only) label the entry. `receiptTaskId` (a cost only) books the entry for a task of the receipt queue like `POST /costs` does; a task that is not waiting any more is a 409 and the suggestion stays pending. Accepting a `link` takes no body fields: the entry named in its payload remembers the transaction (so it is never booked twice and the finance app gets its back-link), nothing new is booked, and the answer's entity is that entry; 409 when the entry was deleted, is tied to a finance item already or no longer has the transaction's amount and currency (dismiss the link then). Accepting twice is a 409. A 409 carries `details.code` where it tells: `suggestion_decided` (accepted or dismissed already, or the transaction is booked), `entry_tied` (a link's entry is tied to a finance item already) or `receipt_task_closed`.",
        "tags": [
          "finance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinanceSuggestionAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 4000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serviceLogId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidByUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "splitMode": {
                    "type": "string",
                    "enum": [
                      "ownership",
                      "equal",
                      "custom",
                      "none"
                    ]
                  },
                  "shares": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "userId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "participantIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "countsAsExpense": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "maintenance",
                      "investment",
                      "no"
                    ]
                  },
                  "tagIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "receiptTaskId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "assetKind": {
                    "type": "string",
                    "enum": [
                      "device",
                      "plant",
                      "fixture",
                      "vehicle",
                      "other"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/finance/suggestions/{id}/dismiss": {
      "post": {
        "operationId": "financeSuggestionsDismiss",
        "summary": "Dismiss a suggestion",
        "description": "A dismissed suggestion is never offered again, except a `link`: dismissing it means \"not that entry\", so its transaction comes back as a normal cost suggestion. Dismissing an accepted one is a 409 with `details.code` `suggestion_decided`.",
        "tags": [
          "finance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinanceSuggestion"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/finance/matches": {
      "get": {
        "operationId": "financeMatches",
        "summary": "Your pending cost suggestions that match an entry being typed",
        "description": "For the cost form: `amountMinor` (signed like `POST /costs`), `currency` (default: the household's) and `date` of the entry being typed. Answers your own pending cost suggestions from the finance app with the same amount and currency booked at most 3 days from `date`, nearest date first (at most 20), so the form can offer \"tie to bank transaction\"; send the chosen id as `financeSuggestionId` to `POST /costs` or `PATCH /costs/{id}`. Strictly your own.",
        "tags": [
          "finance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "amountMinor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "dismissed"
                            ]
                          },
                          "acceptedEntityId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "kind": {
                            "type": "string",
                            "const": "cost"
                          },
                          "payload": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "finance_transaction",
                                  "finance_bill"
                                ]
                              },
                              "date": {
                                "type": "string",
                                "format": "date"
                              },
                              "amountMinor": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "currency": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "payee": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "category": {
                                "type": "string",
                                "enum": [
                                  "repair",
                                  "utilities",
                                  "renewal_fund",
                                  "purchase",
                                  "mortgage_interest",
                                  "mortgage_principal",
                                  "insurance",
                                  "renovation",
                                  "maintenance",
                                  "fuel",
                                  "taxes_fees",
                                  "groceries",
                                  "household",
                                  "dining",
                                  "leisure",
                                  "travel",
                                  "health",
                                  "gifts",
                                  "transport",
                                  "subscriptions",
                                  "other"
                                ]
                              },
                              "url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "assetId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "bookId": {
                                "default": null,
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "source",
                              "date",
                              "amountMinor",
                              "currency",
                              "title",
                              "payee",
                              "category",
                              "url",
                              "assetId",
                              "bookId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "acceptedEntityId",
                          "createdAt",
                          "updatedAt",
                          "kind",
                          "payload"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/finance/sync": {
      "post": {
        "operationId": "financeSync",
        "summary": "Sync your finance connection now",
        "description": "Runs one sync of your own connection (404 without one). A provider that cannot be reached is a normal answer (`ok: false` with an error code), not an HTTP error.",
        "tags": [
          "finance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinanceSync"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/defects": {
      "get": {
        "operationId": "defectsList",
        "summary": "List defects",
        "description": "Defects that still need attention come first, by deadline (none last), then by number. Filter by status (or active=true for open, reported and in progress), severity, room, asset or a search text.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "reported",
                "in_progress",
                "fixed",
                "rejected"
              ]
            }
          },
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Defect"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "defectsCreate",
        "summary": "Record a defect",
        "description": "Without deadlineDate the deadline is the household's handover date plus its defect deadline months, when a handover date is set. A deadline creates a reminder task.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Defect"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "default": "",
                    "type": "string",
                    "maxLength": 50000
                  },
                  "severity": {
                    "default": "medium",
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high"
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "locationDetail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discoveredOn": {
                    "type": "string",
                    "format": "date"
                  },
                  "reportedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "responsibleContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deadlineDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/defects/export.pdf": {
      "get": {
        "operationId": "defectsExport",
        "summary": "Defect list as a PDF",
        "description": "An A4 document: a table of the defects (filtered by status and room) and the history of each one. Language follows the caller's account.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "reported",
                "in_progress",
                "fixed",
                "rejected"
              ]
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/defects/{id}": {
      "get": {
        "operationId": "defectsGet",
        "summary": "Get a defect with its events",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefectDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "defectsUpdate",
        "summary": "Update a defect",
        "description": "The status has its own endpoint. Changing the deadline updates the reminder task.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Defect"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "descriptionMd": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high"
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "locationDetail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discoveredOn": {
                    "type": "string",
                    "format": "date"
                  },
                  "reportedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "responsibleContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deadlineDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deadlineSource": {
                    "type": "string",
                    "const": "handover"
                  },
                  "fixedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resolutionMd": {
                    "type": "string",
                    "maxLength": 50000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "defectsDelete",
        "summary": "Delete a defect",
        "description": "Events, comments and the reminder task go with it. Close a defect (fixed, rejected) to keep the history.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/defects/{id}/status": {
      "post": {
        "operationId": "defectsStatus",
        "summary": "Change the status of a defect",
        "description": "From open, reported or in progress to any other status; fixed and rejected defects can only be reopened. Every change is written to the defect's events. Fixed and rejected archive the reminder task, reopening restores it.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefectDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "reported",
                      "in_progress",
                      "fixed",
                      "rejected"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "reportedOn": {
                    "type": "string",
                    "format": "date"
                  },
                  "fixedOn": {
                    "type": "string",
                    "format": "date"
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/defects/{id}/events": {
      "post": {
        "operationId": "defectsAddEvent",
        "summary": "Note correspondence on a defect",
        "description": "Adds a correspondence entry (a letter sent or received) to the defect's history. Remarks use the generic comments endpoints.",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefectEvent"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "correspondence"
                  },
                  "bodyMd": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "externalRef": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "type",
                  "bodyMd"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/defects/{id}/timeline": {
      "get": {
        "operationId": "defectsTimeline",
        "summary": "Events and comments of a defect, oldest first",
        "tags": [
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DefectTimelineItem"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insurance-policies": {
      "get": {
        "operationId": "insurancePoliciesList",
        "summary": "List insurance policies",
        "description": "Active policies by cancellation deadline (those without one last), then title. Filter by covered asset, type and a text (q: title, policy number or the insurer's name); archived=true lists the archived ones instead. Every policy carries the assets it covers, the insurer's name, the premium normalised to a year and the cancellation deadline derived from the end date and the notice period.",
        "tags": [
          "insurance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "motor_liability",
                "motor_partial_casco",
                "motor_full_casco",
                "household",
                "personal_liability",
                "building",
                "legal",
                "travel",
                "health",
                "life",
                "other"
              ]
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InsurancePolicy"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "insurancePoliciesCreate",
        "summary": "Create an insurance policy",
        "description": "currency defaults to the household's. A policy that renews by itself (renewal auto) with an end date and a notice period gets a cancellation deadline and keeps a reminder task due on that day. endDate is the last day of cover.",
        "tags": [
          "insurance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsurancePolicy"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "type": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "motor_liability",
                      "motor_partial_casco",
                      "motor_full_casco",
                      "household",
                      "personal_liability",
                      "building",
                      "legal",
                      "travel",
                      "health",
                      "life",
                      "other"
                    ]
                  },
                  "insurerContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "policyNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "premiumMinor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "premiumPeriod": {
                    "default": "annual",
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "semiannual",
                      "annual"
                    ]
                  },
                  "deductibleMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "renewal": {
                    "default": "auto",
                    "type": "string",
                    "enum": [
                      "auto",
                      "fixed"
                    ]
                  },
                  "cancellationNoticeMonths": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assistancePhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "showOnEmergency": {
                    "default": false,
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetIds": {
                    "default": [],
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "title",
                  "premiumMinor",
                  "startDate"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/insurance-policies/{id}": {
      "get": {
        "operationId": "insurancePoliciesGet",
        "summary": "Get an insurance policy",
        "tags": [
          "insurance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsurancePolicy"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "insurancePoliciesUpdate",
        "summary": "Update an insurance policy",
        "description": "assetIds replaces the covered assets; archived archives or restores the policy (its reminder task follows). After an automatic renewal, move endDate to the end of the next term: the cancellation deadline and the reminder follow.",
        "tags": [
          "insurance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsurancePolicy"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "motor_liability",
                      "motor_partial_casco",
                      "motor_full_casco",
                      "household",
                      "personal_liability",
                      "building",
                      "legal",
                      "travel",
                      "health",
                      "life",
                      "other"
                    ]
                  },
                  "insurerContactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "policyNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "premiumMinor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "premiumPeriod": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "semiannual",
                      "annual"
                    ]
                  },
                  "deductibleMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "renewal": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fixed"
                    ]
                  },
                  "cancellationNoticeMonths": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assistancePhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "showOnEmergency": {
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "insurancePoliciesDelete",
        "summary": "Delete an insurance policy",
        "description": "Comments, attachments, document links and reminder tasks go with it. Archive the policy to keep it.",
        "tags": [
          "insurance"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/insurance-policies": {
      "get": {
        "operationId": "assetInsurancePoliciesList",
        "summary": "Insurance policies that cover an asset",
        "description": "The same policies as GET /insurance-policies?assetId=, for the asset page; 404 for an unknown asset. Active policies unless archived=true.",
        "tags": [
          "insurance",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InsurancePolicy"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/notes": {
      "get": {
        "operationId": "assetNotesList",
        "summary": "Notes on an asset for the next appointment",
        "description": "Small issues to mention at the next service appointment (\"brakes squeak\"), newest first. status: open (default), resolved or all.",
        "tags": [
          "asset-notes",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "open",
              "type": "string",
              "enum": [
                "open",
                "resolved",
                "all"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssetNote"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetNotesCreate",
        "summary": "Add a note to an asset",
        "description": "A photo of the issue is an attachment of the owner type asset_note.",
        "tags": [
          "asset-notes",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetNote"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "body"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/asset-notes/{id}": {
      "patch": {
        "operationId": "assetNotesUpdate",
        "summary": "Change the text of a note, resolve or reopen it",
        "description": "status resolved records who resolved it and when; open reopens it and forgets the service log entry that had addressed it. A service log entry resolves notes itself (resolvedNoteIds).",
        "tags": [
          "asset-notes"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetNote"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "resolved"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "assetNotesDelete",
        "summary": "Delete a note",
        "description": "Its attachments go with it. Resolve a note to keep it.",
        "tags": [
          "asset-notes"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/asset-notes/{id}/to-defect": {
      "post": {
        "operationId": "assetNotesToDefect",
        "summary": "Turn a note into a defect",
        "description": "Creates a defect on the note's asset (title from the first line, description the whole text, discovered the day the note was written, no deadline) and marks the note resolved with a link to it, in one transaction. Answers with both. 409 when the note already is a defect.",
        "tags": [
          "asset-notes",
          "defects"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "note": {
                      "$ref": "#/components/schemas/AssetNote"
                    },
                    "defect": {
                      "$ref": "#/components/schemas/Defect"
                    }
                  },
                  "required": [
                    "note",
                    "defect"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/appointments": {
      "get": {
        "operationId": "appointmentsList",
        "summary": "List appointments",
        "description": "Appointments of the household (service visits, inspections, deliveries), soonest first. `from` and `to` are days in the household time zone, both included: an appointment is listed when it overlaps one of them (a timed one counts on every day it touches). Filter by asset, task, contact and status; without a status every status is listed. Dates are YYYY-MM-DD, instants UTC ISO strings. All-day appointments carry startDate/endDate (the last day included) and no instants, timed ones the reverse.",
        "tags": [
          "appointments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "taskId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "planned",
                "done",
                "cancelled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Appointment"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "appointmentsCreate",
        "summary": "Create an appointment",
        "description": "A timed appointment needs startsAt (endsAt defaults to an hour later); an all-day one needs allDay true and startDate (endDate defaults to the same day, the last day included). The fields of the other kind are refused, the end must come after the start and an appointment lasts at most 14 days (a timed one may run an hour over, which is what 14 calendar days have more when the clocks go back). It can belong to a task (taskId, optionally the occurrenceKey it is for; without one the occurrence the task shows now is recorded, none for a task that shows none), a device and a contact; the asset defaults to the task's asset. It starts as planned. 400 field errors name the offending field (`taskId`, `assetId`, `contactId` when they do not exist).",
        "tags": [
          "appointments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Appointment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "location": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "allDay": {
                    "default": false,
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endsAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "taskId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "occurrenceKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/appointments/{id}": {
      "get": {
        "operationId": "appointmentsGet",
        "summary": "Get an appointment",
        "tags": [
          "appointments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Appointment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "appointmentsUpdate",
        "summary": "Change an appointment",
        "description": "Changes only the fields given. allDay switches between timed and all-day (then the new kind's start is required); otherwise the fields must fit the appointment as it is and the whole must stay valid, so moving only the start of a timed appointment to after its end is a 400 on endsAt. Changing the task records the occurrence the new task shows now as the occurrenceKey, unless one is sent; sending occurrenceKey null for the same task removes it. Cancel an appointment by setting status to cancelled, reopen it with planned. Setting status to done records the status only; POST /appointments/{id}/complete also completes the task. A request that changes nothing leaves updatedAt alone.",
        "tags": [
          "appointments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Appointment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "location": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "allDay": {
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endsAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "taskId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "occurrenceKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "planned",
                      "done",
                      "cancelled"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "appointmentsDelete",
        "summary": "Delete an appointment",
        "description": "Comments and attachments go with it. Cancel it instead to keep it.",
        "tags": [
          "appointments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/appointments/{id}/complete": {
      "post": {
        "operationId": "appointmentsComplete",
        "summary": "Mark an appointment done",
        "description": "Sets the status to done and, when the appointment belongs to a task, completes the occurrence the appointment is for (its occurrenceKey, recorded when it got the task) as the caller, with the idempotency key `appointment:<id>`: repeating the request completes nothing twice and answers with the first completion and replayed true. Always answers 200; send `{}` when there is no note or date to give. Browser sessions are attributed as manual, API tokens by their kind. The task is left alone (completion null) when it is archived or when that occurrence has been settled meanwhile (the task shows another occurrence, or reports this one as completed, skipped or acknowledged), so the work is never counted twice and no cycle is skipped. An appointment without an occurrenceKey (its task showed none, or it was removed) completes the occurrence the task shows only if that is dated and fell due on or before the last day of the appointment. A cancelled appointment is a 409. Undoing the task's completion later (DELETE /completions/{id}) does not reopen the appointment, and reopening the appointment does not undo the completion.",
        "tags": [
          "appointments",
          "tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "appointment": {
                      "$ref": "#/components/schemas/Appointment"
                    },
                    "completion": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Completion"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "task": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Task"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "appointment",
                    "completion",
                    "task",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "completedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/warranties": {
      "get": {
        "operationId": "warrantiesList",
        "summary": "Warranty overview",
        "description": "Assets with a warranty date, by the day the warranty ends (the later of warrantyUntil and warrantyExtendedUntil). Status: expired once that day has passed, expiring within 90 days, otherwise valid.",
        "tags": [
          "warranties"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "valid",
                "expiring",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Warranty"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/comments": {
      "get": {
        "operationId": "commentsList",
        "summary": "Comments on a task, defect, asset or other entity",
        "description": "Oldest first. Deleted comments stay in the thread with an empty body and deleted=true.",
        "tags": [
          "comments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "task",
                "defect",
                "asset",
                "room",
                "part",
                "contact",
                "service_log",
                "asset_hint",
                "doc_page",
                "cost",
                "insurance_policy",
                "appointment"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Comment"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "commentsCreate",
        "summary": "Add a comment",
        "description": "The other household members involved get an in-app notification.",
        "tags": [
          "comments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Comment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityType": {
                    "type": "string",
                    "enum": [
                      "task",
                      "defect",
                      "asset",
                      "room",
                      "part",
                      "contact",
                      "service_log",
                      "asset_hint",
                      "doc_page",
                      "cost",
                      "insurance_policy",
                      "appointment"
                    ]
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "bodyMd": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  }
                },
                "required": [
                  "entityType",
                  "entityId",
                  "bodyMd"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/comments/{id}": {
      "patch": {
        "operationId": "commentsUpdate",
        "summary": "Edit a comment",
        "description": "Only its author may edit, at any time; the edit time is recorded. Deleted comments cannot be edited.",
        "tags": [
          "comments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Comment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bodyMd": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  }
                },
                "required": [
                  "bodyMd"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "commentsDelete",
        "summary": "Delete a comment",
        "description": "Its author or an administrator may delete. The comment stays in the thread as deleted; deleting twice is not an error.",
        "tags": [
          "comments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/assets/{id}/hints": {
      "get": {
        "operationId": "assetHintsList",
        "summary": "Care hints of an asset",
        "description": "Pinned hints first, then by sort order and creation time.",
        "tags": [
          "hints",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Hint"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "assetHintsCreate",
        "summary": "Add a care hint to an asset",
        "description": "A hint is a tip, rule or warning for using or caring for the device. It may link a recurring task and carry a signal reaction (stored; an adapter carries it out). Without sortOrder it goes to the end.",
        "tags": [
          "hints",
          "assets"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hint"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "bodyMd": {
                    "default": "",
                    "type": "string",
                    "maxLength": 10000
                  },
                  "kind": {
                    "default": "tip",
                    "type": "string",
                    "enum": [
                      "tip",
                      "rule",
                      "warning"
                    ]
                  },
                  "pinned": {
                    "default": false,
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "guestVisible": {
                    "default": false,
                    "type": "boolean"
                  },
                  "taskId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reaction": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/SignalReaction"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/hints": {
      "get": {
        "operationId": "hintsList",
        "summary": "List care hints across assets",
        "description": "Filter by asset, kind or reactive=true (hints with a signal reaction). Archived assets' hints are left out.",
        "tags": [
          "hints"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "reactive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "tip",
                "rule",
                "warning"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Hint"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hints/{id}": {
      "get": {
        "operationId": "hintsGet",
        "summary": "Get a care hint",
        "tags": [
          "hints"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hint"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "hintsUpdate",
        "summary": "Update a care hint",
        "description": "Reorder by changing sortOrder; pin with pinned.",
        "tags": [
          "hints"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hint"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "bodyMd": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "tip",
                      "rule",
                      "warning"
                    ]
                  },
                  "pinned": {
                    "type": "boolean"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "guestVisible": {
                    "type": "boolean"
                  },
                  "taskId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reaction": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/SignalReaction"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "hintsDelete",
        "summary": "Delete a care hint",
        "description": "Its comments go with it; a linked task stays.",
        "tags": [
          "hints"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages": {
      "get": {
        "operationId": "pagesList",
        "summary": "List documentation pages",
        "description": "Pinned first, then by sortOrder and title; with q, best match first. q is a full-text search over title and text (secret blocks excluded); archived pages are never found by it. Archived pages are left out unless includeArchived=true.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "general",
                "device",
                "room",
                "emergency",
                "rules",
                "howto"
              ]
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "pinned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DocPageSummary"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "pagesCreate",
        "summary": "Create a documentation page",
        "description": "The markdown is rendered before the response (member and guest HTML, plain text, headings). 400 `invalid_request` with `details.code` `too_large` (over 200 KB) or `too_complex` (rendering exceeded its time limit) when it cannot be rendered. Writes revision 1. `attachment:<id>` links and images resolve to attachments, `[[slug]]` and `[[slug|label]]` to `/docs/<slug>`.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "docs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "docs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocPage"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "section": {
                    "default": "general",
                    "type": "string",
                    "enum": [
                      "general",
                      "device",
                      "room",
                      "emergency",
                      "rules",
                      "howto"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bodyMd": {
                    "default": "",
                    "type": "string"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "guestVisible": {
                    "default": false,
                    "type": "boolean"
                  },
                  "pinned": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/preview": {
      "post": {
        "operationId": "pagesPreview",
        "summary": "Render markdown for the editor preview",
        "description": "Renders as a member sees the page (secret blocks shown). Nothing is stored. Same size and complexity limits as saving; rate limited per user (429 `rate_limited`).",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "docs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "docs:write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "html": {
                      "type": "string"
                    },
                    "headings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Heading"
                      }
                    }
                  },
                  "required": [
                    "html",
                    "headings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bodyMd": {
                    "type": "string"
                  }
                },
                "required": [
                  "bodyMd"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/{slug}": {
      "get": {
        "operationId": "pagesGet",
        "summary": "Get a documentation page",
        "description": "Markdown source, rendered HTML for members (secret blocks included), headings, revision number and backlinks.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocPage"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "pagesUpdate",
        "summary": "Edit, move, pin or archive a page",
        "description": "`rev` is the revision the client edited; when the page has moved on the answer is 409 `conflict` with `details.currentRev`. Every successful save writes a revision (the last 50 are kept). Changing the slug does not rewrite `[[links]]` in other pages.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "docs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "docs:write"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocPage"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rev": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "section": {
                    "type": "string",
                    "enum": [
                      "general",
                      "device",
                      "room",
                      "emergency",
                      "rules",
                      "howto"
                    ]
                  },
                  "assetId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "roomId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bodyMd": {
                    "type": "string"
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  },
                  "guestVisible": {
                    "type": "boolean"
                  },
                  "pinned": {
                    "type": "boolean"
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "rev"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "pagesDelete",
        "summary": "Delete a page",
        "description": "Removes the page with its revisions and attachments. Archive instead to keep it.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "docs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "docs:write"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/{slug}/revisions": {
      "get": {
        "operationId": "pageRevisionsList",
        "summary": "Revision history of a page, newest first",
        "description": "The last 50 saved states (no markdown; fetch one for that).",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PageRevisionSummary"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/{slug}/revisions/{rev}": {
      "get": {
        "operationId": "pageRevisionsGet",
        "summary": "One saved state of a page, with its markdown",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "rev",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageRevision"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/{slug}/revisions/{rev}/restore": {
      "post": {
        "operationId": "pageRevisionsRestore",
        "summary": "Make an earlier revision the current one",
        "description": "Saves the title and markdown of that revision as a new revision (history is never rewritten, so nothing is lost). Returns the page.",
        "tags": [
          "docs"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "docs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "docs:write"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "rev",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocPage"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "search",
        "summary": "Search pages, assets, rooms, tasks, defects, contacts, parts and care hints",
        "description": "Full-text search, best match first; every word is matched as a prefix. Archived pages, assets, tasks and parts are not searched. Searched fields: titles and names, plus page text, device data and notes, descriptions, a defect's location, a contact's company and notes (never phone, e-mail or address), a part's number, supplier and notes, a hint's text. Pages are searched without their secret blocks, and every other free text is cut off at the first `:::` block when it mentions a secret, so a snippet never contains secret text. Snippets are plain text. `url` is the app path of the hit.",
        "tags": [
          "search"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "page",
                "asset",
                "room",
                "task",
                "defect",
                "contact",
                "part",
                "asset_hint",
                "insurance_policy",
                "appointment",
                "document"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SearchHit"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/attachments": {
      "post": {
        "operationId": "attachmentsUpload",
        "summary": "Upload a file to an owner",
        "description": "multipart/form-data with `file`, `ownerType`, `ownerId`, optional `caption` and `guestVisible`. JPEG, PNG and WebP images are re-encoded (metadata removed, orientation applied, longest side capped) and get a thumbnail; PDFs are stored as uploaded. At most 25 MiB. Errors are 400/413/415 `invalid_request` with `details.code`: `empty`, `too_large` (413), `unsupported_type` (415), `unsupported_heic` (415), `corrupt_image`, `image_too_large` (413); an unknown or unsupported owner is a field error on `ownerId` or `ownerType`. Attaching to a page needs the `docs:write` scope, to a cost entry `costs:write`. The owner type `ai_task` is refused (400 on `ownerType`): a task of the receipt queue gets its file from `POST /ai-tasks`.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Attachment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "contentEncoding": "binary"
                  },
                  "ownerType": {
                    "type": "string",
                    "enum": [
                      "asset",
                      "room",
                      "page",
                      "task",
                      "defect",
                      "service_log",
                      "part",
                      "asset_hint",
                      "contact",
                      "cost",
                      "insurance_policy",
                      "asset_note",
                      "tire_set",
                      "appointment",
                      "ai_task"
                    ]
                  },
                  "ownerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "caption": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "guestVisible": {
                    "type": "string",
                    "enum": [
                      "true",
                      "false"
                    ]
                  }
                },
                "required": [
                  "file",
                  "ownerType",
                  "ownerId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "get": {
        "operationId": "attachmentsList",
        "summary": "List the attachments of an owner",
        "description": "Oldest first.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "ownerType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "asset",
                "room",
                "page",
                "task",
                "defect",
                "service_log",
                "part",
                "asset_hint",
                "contact",
                "cost",
                "insurance_policy",
                "asset_note",
                "tire_set",
                "appointment",
                "ai_task"
              ]
            }
          },
          {
            "name": "ownerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Attachment"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/attachments/{id}": {
      "get": {
        "operationId": "attachmentsGet",
        "summary": "Attachment metadata",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Attachment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "attachmentsUpdate",
        "summary": "Change the caption or the guest visibility",
        "description": "Pages that embed the attachment are rendered again. Needs `docs:write` when the owner is a page.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Attachment"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caption": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "guestVisible": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "attachmentsDelete",
        "summary": "Delete an attachment",
        "description": "Removes the row and, when nothing else uses the stored file, the file (a file stored less than a minute ago is kept until the next cleanup). An asset photo pointing at it is cleared. Pages that embed it are rendered again. Needs `docs:write` when the owner is a page. The file of an open task of the receipt queue (owner type `ai_task`) is a 409 `conflict`: delete the task instead.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/attachments/{id}/content": {
      "get": {
        "operationId": "attachmentsContent",
        "summary": "The file itself",
        "description": "Streams the stored bytes with their detected content type: images and PDFs inline, `?download=1` as a download. Sent with `nosniff`, a restrictive CSP, an ETag (`If-None-Match` answers 304) and `Cache-Control: private, max-age=31536000, immutable`. Works for `<img src>` with the session cookie.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/attachments/{id}/thumb": {
      "get": {
        "operationId": "attachmentsThumb",
        "summary": "Thumbnail of an image attachment",
        "description": "480 px WebP; 404 for attachments without a thumbnail (PDFs). Same headers as the content endpoint.",
        "tags": [
          "attachments"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me/notification-settings": {
      "get": {
        "operationId": "notificationSettingsGet",
        "summary": "The caller's push preferences and notification targets",
        "description": "Own settings only. `pushStages` are the kinds of notification that reach the phone (the in-app list always has all of them); notifications arriving between `quietStart` and `quietEnd` (household time zone) are held back and sent afterwards. A target is a notify service of the connected smart-home system.",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationSettings"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "notificationSettingsPut",
        "summary": "Replace the caller's push preferences and targets",
        "description": "Replaces preferences and the whole list of targets (at most 10). Target names are lowercase letters, digits and underscores.",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationSettings"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pushEnabled": {
                    "type": "boolean"
                  },
                  "quietStart": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "quietEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pushStages": {
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "prep",
                        "due_soon",
                        "due",
                        "overdue",
                        "digest",
                        "hint",
                        "comment"
                      ]
                    }
                  },
                  "targets": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "channel": {
                          "type": "string",
                          "enum": [
                            "ha_notify"
                          ]
                        },
                        "target": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "pattern": "^[a-z0-9_]+$"
                        },
                        "enabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "channel",
                        "target",
                        "enabled"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "pushEnabled",
                  "quietStart",
                  "quietEnd",
                  "pushStages",
                  "targets"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations": {
      "get": {
        "operationId": "integrationsList",
        "summary": "The integrations and their connection status",
        "description": "One entry per kind: the household's connection, or the caller's own for kinds each person connects. Never contains the access token; the address and settings of a household connection are shown to administrators only.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Integration"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}": {
      "put": {
        "operationId": "integrationsSave",
        "summary": "Create or change a connection",
        "description": "Household-level kinds need an administrator. A new connection needs the token, and so does a changed address (a stored token is never sent to another host); a blank token keeps the stored one. The status resets to `unknown` until the next check.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "token": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "allowInsecureTls": {
                    "default": false,
                    "type": "boolean"
                  },
                  "config": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "baseUrl"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "integrationsDelete",
        "summary": "Remove a connection",
        "description": "Household-level kinds need an administrator. Tasks, assets and hints that refer to the system keep working without live data.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/test": {
      "post": {
        "operationId": "integrationsTest",
        "summary": "Check the connection now",
        "description": "Calls the system once and records the outcome as the connection's status. An unreachable system is a normal answer (`ok: false` with an error code and message), not an HTTP error. Household-level kinds need an administrator.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationTest"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/entities": {
      "get": {
        "operationId": "integrationsEntities",
        "summary": "Entities of the connected system (entity picker)",
        "description": "From a short-lived cache of the system's states. Filter by `q` (id or name) and `domain`. 404 when the kind has no connection or no such operation; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "domain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z0-9_]+$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalEntity"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "items",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/notify-services": {
      "get": {
        "operationId": "integrationsNotifyServices",
        "summary": "Notify services of the connected system",
        "description": "Candidates for a person's notification targets.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/calendars": {
      "get": {
        "operationId": "integrationsCalendars",
        "summary": "Calendars of the connected system",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalCalendar"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/devices": {
      "get": {
        "operationId": "integrationsDevices",
        "summary": "Devices of the connected system that no asset represents yet",
        "description": "Suggestions for the inventory: manufacturer, model, name and area of every enabled device that matches no asset (by external reference, name, or manufacturer and model). Creating an asset from one is a separate call with `externalSource` and `externalRef`.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalDevice"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/areas": {
      "get": {
        "operationId": "integrationsAreas",
        "summary": "Areas of the connected system (area picker)",
        "description": "Every area with its name, the name of its floor when the system has floors, and the id of the room that already stores it in `haAreaId` (null when none does). Candidates for `POST /rooms/import-areas`. 404 without a connection or for a kind without areas; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalArea"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/tags": {
      "get": {
        "operationId": "integrationsTags",
        "summary": "Tags of the connected document system",
        "description": "From the caller's own connection (each person connects their own account). 404 without a connection or for a kind without tags; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalTag"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/correspondents": {
      "get": {
        "operationId": "integrationsCorrespondents",
        "summary": "Correspondents of the connected document system",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalCorrespondent"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/custom-fields": {
      "get": {
        "operationId": "integrationsCustomFields",
        "summary": "Custom fields of the connected document system",
        "description": "Candidates for the warranty fields: pick date fields.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalCustomField"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/groups": {
      "get": {
        "operationId": "integrationsGroups",
        "summary": "Groups of the connected document system",
        "description": "Candidates for the groups that get access to pushed documents. The account needs the permission to view groups, otherwise 502 `upstream_error` with `details.code` `forbidden`.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalGroup"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/storage-paths": {
      "get": {
        "operationId": "integrationsStoragePaths",
        "summary": "Storage paths of the connected document system",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalStoragePath"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents": {
      "get": {
        "operationId": "documentsList",
        "summary": "Documents of the caller's document system",
        "description": "Read through the caller's own connection, so everybody sees what their own account may see. With `q` the title and text are searched live in the provider (at most 100 hits); without it the synced household documents are listed (tag, correspondent and linked filters apply to both). Every item says where hauswart uses it (`linkedTo`). 404 without a connection; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "correspondent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "linked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalDocument"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/suggestions": {
      "get": {
        "operationId": "documentsSuggestions",
        "summary": "Inventory and contact suggestions from the document system",
        "description": "`kind=asset`: receipts (documents with a receipt tag) with a warranty date that no asset is linked to yet; accepting creates the asset and links the document with role `receipt` (the link fills the warranty dates). `kind=contact`: correspondents of the synced documents that no contact stands for yet; pass `externalSource` and `externalRef` of the item when creating the contact. Built from the caller's own synced documents only.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "asset",
                "contact"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/AssetSuggestion"
                          },
                          {
                            "$ref": "#/components/schemas/ContactSuggestion"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/uploads/{jobId}": {
      "get": {
        "operationId": "documentUploadsGet",
        "summary": "State of a push to the document system",
        "description": "Only the person who started the job sees it (404 for everybody else). Poll until `status` is `done` or `failed`.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUpload"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{provider}/{externalId}": {
      "get": {
        "operationId": "documentsGet",
        "summary": "One document: metadata and where it is used",
        "description": "Asked live through the caller's own connection (never another person's): 404 when the caller has no connection or the system does not show them the document.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "paperless"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalDocumentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{provider}/{externalId}/preview": {
      "get": {
        "operationId": "documentsPreview",
        "summary": "Preview of a document (PDF or image)",
        "description": "Streamed through the caller's own connection, at most 25 MB; only PDF, raster images and plain text are sent inline, anything else as `application/octet-stream` download. `nosniff`, a restrictive CSP, `Cache-Control: private`. 404 without a connection or when the account may not see the document.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "paperless"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/avif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/bmp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/tiff": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{provider}/{externalId}/thumb": {
      "get": {
        "operationId": "documentsThumb",
        "summary": "Thumbnail of a document",
        "description": "Same rules as the preview; WebP.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "paperless"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/avif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/bmp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/tiff": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{provider}/{externalId}/download": {
      "get": {
        "operationId": "documentsDownload",
        "summary": "Download of a document",
        "description": "The archived PDF, or with `?original=1` the original file; sent as an attachment. Same rules as the preview.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "paperless"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "original",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/avif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/bmp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/tiff": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/document-links": {
      "get": {
        "operationId": "documentLinksList",
        "summary": "Links between documents and things in hauswart",
        "description": "Filter by owner (`ownerType` + `ownerId`) or by document (`provider` + `externalId`). Each link says whether the caller's own account can read the document (`available`); a document that is not shared with the caller shows no title.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "ownerType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asset",
                "room",
                "page",
                "task",
                "defect",
                "service_log",
                "part",
                "contact",
                "cost",
                "insurance_policy"
              ]
            }
          },
          {
            "name": "ownerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "paperless"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DocumentLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "documentLinksCreate",
        "summary": "Link a document to an asset, room, task, ...",
        "description": "The caller's own account must be able to read the document (404 otherwise). The same document can be linked to the same owner once per role (409 `conflict`). A receipt or warranty document on an asset fills its warranty dates when they are empty or came from a document. A page owner needs `docs:write`. With the connection setting `writeBackNotes` a note with the hauswart link is added to the document (once).",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentLink"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "default": "paperless",
                    "type": "string",
                    "enum": [
                      "paperless"
                    ]
                  },
                  "externalId": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "ownerType": {
                    "type": "string",
                    "enum": [
                      "asset",
                      "room",
                      "page",
                      "task",
                      "defect",
                      "service_log",
                      "part",
                      "contact",
                      "cost",
                      "insurance_policy"
                    ]
                  },
                  "ownerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "role": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "manual",
                      "receipt",
                      "warranty",
                      "datasheet",
                      "correspondence",
                      "invoice",
                      "policy",
                      "registration",
                      "other"
                    ]
                  },
                  "label": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "externalId",
                  "ownerType",
                  "ownerId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/document-links/{id}": {
      "delete": {
        "operationId": "documentLinksDelete",
        "summary": "Remove a link",
        "description": "Only the link: the document stays in its system and an asset keeps the warranty dates it got. A page owner needs `docs:write`.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/attachments/{id}/push-to-documents": {
      "post": {
        "operationId": "attachmentsPushToDocuments",
        "summary": "Send an attachment to the caller's document system",
        "description": "Starts a job (202) that uploads the file with the connection's upload tags, storage path and correspondent, waits until the system has consumed it, gives the connection's groups access, links the new document to the attachment's owner and, when enabled, leaves a note with the hauswart link. Poll `GET /documents/uploads/{jobId}`. Owners that cannot be linked (a hint) are refused with 400; 404 without a connection.",
        "tags": [
          "documents"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUpload"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "default": "paperless",
                    "type": "string",
                    "enum": [
                      "paperless"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "role": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "manual",
                      "receipt",
                      "warranty",
                      "datasheet",
                      "correspondence",
                      "invoice",
                      "policy",
                      "registration",
                      "other"
                    ]
                  },
                  "label": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/categories": {
      "get": {
        "operationId": "integrationsCategories",
        "summary": "Categories of the connected finance app (category map picker)",
        "description": "Your own connection only. 404 when you have no connection of this kind or it has no such operation; 502 `upstream_error` when the system does not answer.",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FinanceCategory"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/{kind}/accounts": {
      "get": {
        "operationId": "integrationsAccounts",
        "summary": "Accounts of the connected finance app",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "homeassistant",
                "paperless",
                "kept"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FinanceAccount"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ha/action": {
      "post": {
        "operationId": "haAction",
        "summary": "A button on a pushed notification was tapped",
        "description": "Called by the smart-home system when someone taps \"done\" on a notification: `{\"action\": \"HW_DONE_<token>\"}` with an API token of kind `ha` and the `ha:action` scope. The token resolves to the task occurrence the notification was about and to the person it was sent to; the completion is attributed to that person (source `notification`), not to the calling token. 404 for an unknown action, 410 `gone` when the token expired, its task is gone, the occurrence was settled otherwise, or the first completion was undone. Tapping again (or a retried request) answers 200 with the first completion and `replayed: true`.",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "bearerAuth": [
              "ha:action"
            ]
          }
        ],
        "x-required-scopes": [
          "ha:action"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationActionResult"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "410": {
            "description": "Error: `gone`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "action"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-feeds": {
      "get": {
        "operationId": "calendarFeedsList",
        "summary": "List the calling user's calendar feeds",
        "description": "Each feed has a secret subscription address (`url`, `https://…/api/public/cal/<token>.ics`) for any calendar app; only its owner sees it. Other users' feeds are not visible.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CalendarFeed"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "calendarFeedsCreate",
        "summary": "Create a calendar feed",
        "description": "`scope` `mine` = tasks assigned to the caller or to nobody, `all` = every active task. Estimated dates are only included with `includeEstimated`. `alarmTime` (`HH:MM`, household time zone) adds an alarm `alarmDaysBefore` days ahead of each event (1 = the evening before). At most 10 feeds per user.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarFeed"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "scope": {
                    "default": "mine",
                    "type": "string",
                    "enum": [
                      "mine",
                      "all"
                    ]
                  },
                  "includeEstimated": {
                    "default": false,
                    "type": "boolean"
                  },
                  "includePreparations": {
                    "default": true,
                    "type": "boolean"
                  },
                  "includeDefects": {
                    "default": true,
                    "type": "boolean"
                  },
                  "includeWarranties": {
                    "default": true,
                    "type": "boolean"
                  },
                  "alarmTime": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "alarmDaysBefore": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 30
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-feeds/{id}": {
      "patch": {
        "operationId": "calendarFeedsUpdate",
        "summary": "Change a calendar feed",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarFeed"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "mine",
                      "all"
                    ]
                  },
                  "includeEstimated": {
                    "type": "boolean"
                  },
                  "includePreparations": {
                    "type": "boolean"
                  },
                  "includeDefects": {
                    "type": "boolean"
                  },
                  "includeWarranties": {
                    "type": "boolean"
                  },
                  "alarmTime": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "alarmDaysBefore": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 30
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "calendarFeedsDelete",
        "summary": "Delete a calendar feed",
        "description": "The subscription address stops working at once (404).",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-feeds/{id}/rotate": {
      "post": {
        "operationId": "calendarFeedsRotate",
        "summary": "Give a calendar feed a new address",
        "description": "The old address stops working at once; subscribers must use the new `url`.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarFeed"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-targets": {
      "get": {
        "operationId": "calendarTargetsList",
        "summary": "The calendars hauswart pushes items into",
        "description": "The household's targets and the caller's own (another person's are not visible). A target pushes appointments, due dates, preparations and deadlines into one calendar of a connected system (`direction` is `push`: the calendar is never read back, edits there are not noticed until the item changes in hauswart). Every target has the calendar it writes into (`remoteCalendarId`, and `remoteName`, its name in the connected system, which follows a rename there), its health (`status`, `lastError`, `consecutiveFailures`, `lastCheckedAt`, and `nextAttemptAt`: not before when it is tried again, by the back-off after failures), what the last run did (`lastStats`), what the calendar allows (`capabilities`) and whether the caller may change it (`canManage`).",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CalendarTarget"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "calendarTargetsCreate",
        "summary": "Add a calendar to push items into",
        "description": "`provider` is the connected system, `remoteCalendarId` a calendar from `GET /integrations/{provider}/calendars` (one that allows creating events). Calendars of the household's connection are administrators' business and always carry everything (`scope` `all`); a person's own connection gives targets of that person. `config.kinds` says what goes in (`appointments`, `task_due`, `preparations`, `defect_deadlines`, `insurance_deadlines`, `warranty_ends`); items that only have a date become all-day events or, with `timedMode` `timed`, events of `dueDurationMinutes` from `dueTime`. The first sync follows at once. 404 without a working connection or adapter, 400 on `remoteCalendarId` for a calendar that does not exist (`details.code` `calendar_not_found`) or cannot take events (`calendar_unsupported`), 409 for a calendar that already has a target, 502 `upstream_error` when the system does not answer.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarTarget"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "homeassistant"
                    ]
                  },
                  "remoteCalendarId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "config": {
                    "type": "object",
                    "properties": {
                      "kinds": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "appointments",
                            "task_due",
                            "preparations",
                            "defect_deadlines",
                            "insurance_deadlines",
                            "warranty_ends"
                          ]
                        }
                      },
                      "direction": {
                        "default": "push",
                        "type": "string",
                        "enum": [
                          "push"
                        ]
                      },
                      "scope": {
                        "default": "all",
                        "type": "string",
                        "enum": [
                          "mine",
                          "all"
                        ]
                      },
                      "timedMode": {
                        "default": "all_day",
                        "type": "string",
                        "enum": [
                          "all_day",
                          "timed"
                        ]
                      },
                      "dueTime": {
                        "default": "08:00",
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      "dueDurationMinutes": {
                        "default": 30,
                        "type": "integer",
                        "minimum": 5,
                        "maximum": 480
                      },
                      "alarmMinutes": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 40320
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "titlePrefix": {
                        "default": "",
                        "type": "string",
                        "maxLength": 30
                      },
                      "onRemoteDelete": {
                        "default": "recreate",
                        "type": "string",
                        "enum": [
                          "recreate",
                          "forget"
                        ]
                      },
                      "conflictPolicy": {
                        "default": "hauswart_wins",
                        "type": "string",
                        "enum": [
                          "hauswart_wins"
                        ]
                      },
                      "locale": {
                        "default": "de",
                        "type": "string",
                        "enum": [
                          "de",
                          "en"
                        ]
                      }
                    },
                    "required": [
                      "kinds"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "provider",
                  "remoteCalendarId",
                  "config"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-targets/{id}": {
      "patch": {
        "operationId": "calendarTargetsUpdate",
        "summary": "Change a calendar target",
        "description": "`config` is merged over the stored settings (send the fields that change). The next sync applies it: events of kinds that are no longer carried are removed from the calendar when it allows deleting. Household targets need an administrator; another person's target is a 404.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarTarget"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "config": {
                    "type": "object",
                    "properties": {
                      "kinds": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "appointments",
                            "task_due",
                            "preparations",
                            "defect_deadlines",
                            "insurance_deadlines",
                            "warranty_ends"
                          ]
                        }
                      },
                      "direction": {
                        "type": "string",
                        "enum": [
                          "push"
                        ]
                      },
                      "scope": {
                        "type": "string",
                        "enum": [
                          "mine",
                          "all"
                        ]
                      },
                      "timedMode": {
                        "type": "string",
                        "enum": [
                          "all_day",
                          "timed"
                        ]
                      },
                      "dueTime": {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      "dueDurationMinutes": {
                        "type": "integer",
                        "minimum": 5,
                        "maximum": 480
                      },
                      "alarmMinutes": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 40320
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "titlePrefix": {
                        "type": "string",
                        "maxLength": 30
                      },
                      "onRemoteDelete": {
                        "type": "string",
                        "enum": [
                          "recreate",
                          "forget"
                        ]
                      },
                      "conflictPolicy": {
                        "type": "string",
                        "enum": [
                          "hauswart_wins"
                        ]
                      },
                      "locale": {
                        "type": "string",
                        "enum": [
                          "de",
                          "en"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "calendarTargetsDelete",
        "summary": "Remove a calendar target",
        "description": "The events hauswart wrote stay in the calendar, and a new target for the same calendar takes them over, unless `removeRemote=true`: then the events carrying hauswart's marker are deleted first, while no sync of the target can run (409 `conflict` with `details.code` `busy` when one is running right now: try again in a moment; 400 on `removeRemote` for a calendar that cannot delete events; 409 when the connection is switched off; 502 `upstream_error` when the system fails). A failure before an event was touched leaves the target as it was; one that stops after the removal began (`details.deleted`, `details.remaining`, `details.disabled` true) leaves the target in place but switched off, so that the next sync does not write the events again, and a second try continues. Household targets need an administrator.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "removeRemote",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Error: `upstream_error`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-targets/{id}/sync": {
      "post": {
        "operationId": "calendarTargetsSync",
        "summary": "Sync a calendar target now",
        "description": "Runs the sync of the target at once, whatever the back-off says, and answers with what it did (`counts`) and the fresh target. A run is limited in size: `counts.remaining` is the work left for the next run. A failed run is a normal answer (`ok: false` with an error `code`, also on the target as `lastError`): `unauthorized`, `forbidden`, `timeout`, `network`, `tls`, `server`, `blocked_host` and other codes of the connection, `calendar_missing`, `unsupported` (the calendar cannot take events), `unconfirmed` (the calendar did not show events just written), `config_invalid`, `busy` (a run is going on), `disabled` and `no_connection`. Household targets need an administrator.",
        "tags": [
          "calendar"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "write"
            ]
          }
        ],
        "x-required-scopes": [
          "write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarSync"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emergency": {
      "get": {
        "operationId": "emergencyGet",
        "summary": "Everything for the emergency page",
        "description": "Pages of the sections `emergency` and `rules` (member HTML, secret blocks included), contacts marked as emergency contacts and devices marked `showOnEmergency` with their pinned hints.",
        "tags": [
          "emergency"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Emergency"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emergency/export.pdf": {
      "get": {
        "operationId": "emergencyExport",
        "summary": "Printable emergency and cover sheet as a PDF",
        "description": "An A4 document with the emergency contacts, the important places and devices (with pinned hints) and the text of the emergency and rules pages. Secret blocks are left out unless `includeSecrets=1`; the sheet then carries a prominent confidentiality notice. Language follows the caller's account.",
        "tags": [
          "emergency"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "includeSecrets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/guest-links": {
      "get": {
        "operationId": "guestLinksList",
        "summary": "List the household's guest links",
        "description": "All members see and manage all guest links. The address is shown on creation only; a lost one is replaced with a rotation.",
        "tags": [
          "guest-links"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GuestLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "guestLinksCreate",
        "summary": "Create a guest link",
        "description": "`expiresAt` is required and at most 90 days away. `pin` (4 to 8 digits) adds a PIN gate. A guest sees only content flagged guest-visible that the link's `sections` (and `pageIds`) cover; secret blocks only with `includeSecrets`. The response carries the address (`url`, `/g/<token>`) once.",
        "tags": [
          "guest-links"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedGuestLink"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "startsAt": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "pin": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4,8}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "includeSecrets": {
                    "default": false,
                    "type": "boolean"
                  },
                  "sections": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "emergency",
                        "rules",
                        "contacts",
                        "devices",
                        "howto"
                      ]
                    }
                  },
                  "pageIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  }
                },
                "required": [
                  "label",
                  "expiresAt"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/guest-links/{id}": {
      "patch": {
        "operationId": "guestLinksUpdate",
        "summary": "Change a guest link",
        "description": "`pin` sets a new PIN (which also reopens a link closed by wrong guesses) or removes it with null. A revoked link cannot be changed (409).",
        "tags": [
          "guest-links"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuestLink"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "startsAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "pin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4,8}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "includeSecrets": {
                    "type": "boolean"
                  },
                  "sections": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "emergency",
                        "rules",
                        "contacts",
                        "devices",
                        "howto"
                      ]
                    }
                  },
                  "pageIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "de",
                      "en"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "guestLinksRevoke",
        "summary": "Revoke a guest link",
        "description": "The address stops working at once; the link stays in the list as revoked.",
        "tags": [
          "guest-links"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/guest-links/{id}/rotate": {
      "post": {
        "operationId": "guestLinksRotate",
        "summary": "Give a guest link a new address",
        "description": "The old address stops working at once. The response carries the new address (`url`) once.",
        "tags": [
          "guest-links"
        ],
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedGuestLink"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks": {
      "post": {
        "operationId": "aiTasksCreate",
        "summary": "Put a receipt in the queue for an assistant to book",
        "description": "multipart/form-data with `file` (an image or a PDF, like an attachment: JPEG, PNG and WebP images are re-encoded and lose their metadata, PDFs are stored as uploaded, at most 25 MiB; the same `invalid_request` errors with `details.code` as `POST /attachments`), optional `kind` (only `receipt` today, the default), `note` (the uploader's own words, at most 1000 characters) and the hints `bookId` (an open cost book, else a 400 on `bookId`) and `assetId`. The task starts `pending` and is shared by the whole household; the caller is its uploader, who is the default payer of what is booked from it. An assistant (the MCP tools `list_ai_tasks`, `get_ai_task`, `complete_ai_task`, `dismiss_ai_task`) reads the receipt, books the entries and completes the task. Needs `costs:write` because the outcome is cost entries. A repeated `idempotencyKey` (8 to 128 characters; unique per person who uploads, whatever credential they use) returns the first task with status 200 and stores and queues nothing; the same key for a different receipt (another file, or another kind, book or device; the note does not count) is a 409 `conflict` with `details.code` `idempotency_key_reused`; once the task is deleted its key is free again. Send one per receipt and keep it for a retry that got no answer.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTask"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "contentEncoding": "binary"
                  },
                  "kind": {
                    "default": "receipt",
                    "type": "string",
                    "enum": [
                      "receipt"
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bookId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "assetId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "get": {
        "operationId": "aiTasksList",
        "summary": "List the tasks of the receipt queue",
        "description": "Every member sees every task (the queue is household data, like cost entries). Newest first; filter by `status` (`pending|done|dismissed`) and `kind`. Without a filter all statuses are listed.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "done",
                "dismissed"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "receipt",
                "fuel_receipt",
                "service_invoice",
                "insurance_policy"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AiTask"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/count": {
      "get": {
        "operationId": "aiTasksCount",
        "summary": "Count the tasks of the receipt queue",
        "description": "`{count}` with the filters of the list (`status`, `kind`) and without reading the tasks, for a badge: `?status=pending` is how many receipts wait to be booked. Every member sees the same number (the queue is household data). The dashboard carries the pending count as `pendingReceiptCount`.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "done",
                "dismissed"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "receipt",
                "fuel_receipt",
                "service_invoice",
                "insurance_policy"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTaskCount"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/{id}": {
      "get": {
        "operationId": "aiTasksGet",
        "summary": "Get a task of the receipt queue",
        "description": "With the file (`attachment`, whose `url` and `thumbUrl` serve it), the uploader's note and hints, `claim` (who opened the pending task within the last 15 minutes, if anybody), `bookedSoFar` (the cost entries that exist and were booked for the task with `receiptTaskId`, oldest first: what an interrupted client or somebody else's client already did) and, once processed, the result: the ids the processor reported and the cost entries that still exist (`result.costs`).",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTask"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "aiTasksDelete",
        "summary": "Delete a task",
        "description": "Only the uploader or an administrator (403 `forbidden` otherwise). Removes the task and the file while it still belongs to the task (pending or dismissed); a file that moved to a cost entry stays there as that entry's receipt. The cost entries are not touched.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/{id}/preview": {
      "get": {
        "operationId": "aiTasksPreview",
        "summary": "The task's file sized for an assistant to read",
        "description": "The receipt as an image of at most 1600 px on the longest side and about 1.5 MB: an image that is smaller is sent as stored, a larger one is scaled down and sent as JPEG (a very long, narrow receipt may keep up to 3200 px on its long side so that its text stays legible). A PDF is sent as stored. 404 when the task has no file any more. Sent with `nosniff`, an `ETag` and `Cache-Control: private, no-cache` (a copy is kept but asked about every time, since the scaled copy can change while the file does not: `If-None-Match` answers 304); use `GET /attachments/{id}/content` (the task's `attachment.url`) for the original.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "read"
            ]
          }
        ],
        "x-required-scopes": [
          "read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/{id}/claim": {
      "post": {
        "operationId": "aiTasksClaim",
        "summary": "Mark a task as being worked on",
        "description": "A soft lease for clients that work through the queue: it records the caller as the one who opened the pending task, for 15 minutes (renewed by calling this again, and by booking for the task with `receiptTaskId`), and answers the task with its `claim`. If somebody else holds an unexpired lease it stays theirs and the answer says so, so a client can warn before it books a receipt another client may be booking right now. Nothing is locked: booking and completing work for everybody, and the rules of the queue (a closed task takes no more bookings, a second completion with other entries is a 409) are what keep a receipt from being booked twice. A task that is done or dismissed is answered as it is, with no claim. No request body; needs `costs:write` like the other writes of the queue.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTask"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/{id}/complete": {
      "post": {
        "operationId": "aiTasksComplete",
        "summary": "Close a task as done with the entries it produced",
        "description": "`createdCostIds` and `createdFuelLogIds` name entries that must exist (400 on the field otherwise) and must be the task's result: booked for this task (`receiptTaskId`) or created after the task was queued. An entry that existed before the task, a fuel log entry made before it and an entry booked for another task are a 400 on the field, naming the ids (a payment booked twice is not what the receipt became; dismiss the task if it was booked already). At least one entry is needed (a receipt that produced nothing is dismissed instead). In one transaction every cost entry named, and the cost entry each named fuel log entry booked, is flagged `reviewNeeded` (it was booked from a receipt somebody else read; entries booked for the task were flagged then, and a review a person did since is never undone), the file moves to the first of those cost entries as its receipt (the others get a copy; a free fuel fill has no cost entry) and the task becomes `done` with the result, `completedAt`, `completedVia` (`session` or the token kind) and who closed it (`completedByUserId`, `completedByName`: the person in the browser, or the owner of the token). `note` is for the people reading the entries (what was unsure). Idempotent: completing a done task with the same entries (in any order) answers 200 with the task as it is (the first closer stays); with other entries it is a 409 `conflict`, and so is completing a dismissed task. Send a JSON body.",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTask"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "createdCostIds": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "createdFuelLogIds": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-tasks/{id}/dismiss": {
      "post": {
        "operationId": "aiTasksDismiss",
        "summary": "Close a task without booking anything",
        "description": "For a file that is no receipt, unreadable or already booked; `reason` (at most 500 characters) tells the uploader why. The file stays with the task until the task is deleted. Who dismissed it is recorded like for a completion (`completedByUserId`, `completedByName`). Idempotent: dismissing a dismissed task answers 200 with the task as it is (the first reason and the first closer stay); a done task is a 409 `conflict`. Send a JSON body (`{}` is enough).",
        "tags": [
          "ai-tasks"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": [
              "costs:write"
            ]
          }
        ],
        "x-required-scopes": [
          "costs:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiTask"
                }
              }
            }
          },
          "400": {
            "description": "Error: `invalid_request`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Error: `unauthenticated`, `setup_required`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error: `forbidden`, `csrf_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error: `not_found`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Error: `conflict`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Error: `invalid_request` (request body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Error: `invalid_request` (unsupported content type)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Error: `rate_limited`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Error: `internal`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "hauswart_session",
        "description": "Browser session cookie set by login or setup."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API token (`hw_...`) from `POST /api/v1/auth/token` or `POST /api/v1/tokens`. Listed scopes are required."
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "invalid_request",
                  "not_found",
                  "conflict",
                  "rate_limited",
                  "csrf_failed",
                  "gone",
                  "upstream_error",
                  "setup_required",
                  "setup_complete",
                  "invalid_credentials",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {}
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "locale": {
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          }
        },
        "required": [
          "id",
          "username",
          "displayName",
          "role",
          "locale"
        ],
        "additionalProperties": false
      },
      "ApiToken": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "mobile",
              "integration",
              "ha",
              "mcp"
            ]
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "docs:write",
                "costs:write",
                "ha:action",
                "admin"
              ]
            }
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "prefix",
          "scopes",
          "lastUsedAt",
          "expiresAt",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "CreatedApiToken": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "mobile",
              "integration",
              "ha",
              "mcp"
            ]
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "docs:write",
                "costs:write",
                "ha:action",
                "admin"
              ]
            }
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "token": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "prefix",
          "scopes",
          "lastUsedAt",
          "expiresAt",
          "createdAt",
          "token"
        ],
        "additionalProperties": false
      },
      "AdminUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "locale": {
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          },
          "ownershipBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "username",
          "displayName",
          "role",
          "locale",
          "ownershipBps",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "Room": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "haAreaId": {
            "type": [
              "string",
              "null"
            ]
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "haAreaId",
          "icon",
          "sortOrder",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "RoomAreaImport": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "areaId": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "created",
                    "linked",
                    "unchanged",
                    "not_found"
                  ]
                },
                "room": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Room"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "areaId",
                "outcome",
                "room"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "Asset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "device",
              "plant",
              "fixture",
              "vehicle",
              "other"
            ]
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "qrSlug": {
            "type": "string"
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "manufacturer": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchaseDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "installedDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyExtendedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantySource": {
            "type": "string",
            "enum": [
              "manual",
              "document"
            ]
          },
          "showOnEmergency": {
            "type": "boolean"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "species": {
            "type": [
              "string",
              "null"
            ]
          },
          "light": {
            "type": [
              "string",
              "null"
            ]
          },
          "waterNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "photoAttachmentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "photoUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "vehicle": {
            "$ref": "#/components/schemas/VehicleSummary"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "slug",
          "qrSlug",
          "roomId",
          "roomName",
          "category",
          "manufacturer",
          "model",
          "serialNumber",
          "purchaseDate",
          "installedDate",
          "warrantyUntil",
          "warrantyExtendedUntil",
          "warrantySource",
          "showOnEmergency",
          "notes",
          "species",
          "light",
          "waterNotes",
          "photoAttachmentId",
          "photoUrl",
          "externalSource",
          "externalRef",
          "archivedAt",
          "commentCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "VehicleSummary": {
        "type": "object",
        "properties": {
          "plate": {
            "type": [
              "string",
              "null"
            ]
          },
          "odometer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OdometerSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "plate",
          "odometer"
        ],
        "additionalProperties": false
      },
      "OdometerSummary": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "unit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          }
        },
        "required": [
          "value",
          "date",
          "unit"
        ],
        "additionalProperties": false
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "descriptionMd": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "cleaning",
              "maintenance",
              "filter",
              "plant",
              "waste",
              "inspection",
              "payment",
              "order",
              "warranty",
              "defect",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high"
            ]
          },
          "effortMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "trigger": {
            "$ref": "#/components/schemas/Trigger"
          },
          "assignMode": {
            "type": "string",
            "enum": [
              "none",
              "fixed",
              "rotate"
            ]
          },
          "assigneeUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rotationOrder": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rotationStrategy": {
            "type": "string",
            "enum": [
              "alternate",
              "fair"
            ]
          },
          "notifyMode": {
            "type": "string",
            "enum": [
              "assignee",
              "all"
            ]
          },
          "graceDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "dueSoonDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "snoozedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "seed",
              "kept",
              "paperless",
              "ha",
              "mcp",
              "system"
            ]
          },
          "externalSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "openNoteCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextAppointment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NextAppointment"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskState"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "title",
          "descriptionMd",
          "category",
          "priority",
          "effortMinutes",
          "assetId",
          "assetName",
          "roomId",
          "roomName",
          "trigger",
          "assignMode",
          "assigneeUserId",
          "rotationOrder",
          "rotationStrategy",
          "notifyMode",
          "graceDays",
          "dueSoonDays",
          "snoozedUntil",
          "archivedAt",
          "source",
          "externalSource",
          "externalRef",
          "externalUrl",
          "createdBy",
          "commentCount",
          "openNoteCount",
          "nextAppointment",
          "createdAt",
          "updatedAt",
          "state"
        ],
        "additionalProperties": false
      },
      "Trigger": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "interval"
              },
              "every": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3650
              },
              "unit": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month",
                  "year"
                ]
              },
              "anchor": {
                "type": "string",
                "enum": [
                  "completion",
                  "schedule"
                ]
              },
              "startDate": {
                "type": "string"
              },
              "seasons": {
                "maxItems": 12,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "fromMonth": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "toMonth": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "every": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3650
                    },
                    "unit": {
                      "type": "string",
                      "enum": [
                        "day",
                        "week",
                        "month",
                        "year"
                      ]
                    }
                  },
                  "required": [
                    "fromMonth",
                    "toMonth",
                    "every",
                    "unit"
                  ],
                  "additionalProperties": false
                }
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "v",
              "type",
              "every",
              "unit",
              "anchor",
              "startDate"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "calendar"
              },
              "freq": {
                "type": "string",
                "enum": [
                  "weekly",
                  "monthly",
                  "yearly"
                ]
              },
              "interval": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3650
              },
              "byWeekday": {
                "minItems": 1,
                "maxItems": 7,
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 7
                }
              },
              "byMonthDay": {
                "type": "integer",
                "minimum": -31,
                "maximum": 31
              },
              "nth": {
                "type": "integer",
                "minimum": -5,
                "maximum": 5
              },
              "byMonth": {
                "minItems": 1,
                "maxItems": 12,
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                }
              },
              "startDate": {
                "type": "string"
              },
              "earlyDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 366
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "v",
              "type",
              "freq",
              "interval",
              "startDate"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "min_per_period"
              },
              "period": {
                "type": "string",
                "enum": [
                  "week",
                  "month",
                  "quarter",
                  "year"
                ]
              },
              "count": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3650
              },
              "remindFromFraction": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "startDate": {
                "type": "string"
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "v",
              "type",
              "period",
              "count"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "counter_delta"
              },
              "entityId": {
                "type": "string",
                "minLength": 1
              },
              "threshold": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "unit": {
                "type": "string"
              },
              "orEvery": {
                "type": "object",
                "properties": {
                  "every": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3650
                  },
                  "unit": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ]
                  }
                },
                "required": [
                  "every",
                  "unit"
                ],
                "additionalProperties": false
              },
              "autoCompleteOnReset": {
                "type": "object",
                "properties": {
                  "minDrop": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  }
                },
                "required": [
                  "minDrop"
                ],
                "additionalProperties": false
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "v",
              "type",
              "entityId",
              "threshold"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "state_condition"
              },
              "entityId": {
                "type": "string",
                "minLength": 1
              },
              "op": {
                "type": "string",
                "enum": [
                  "eq",
                  "ne",
                  "gt",
                  "gte",
                  "lt",
                  "lte"
                ]
              },
              "value": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "forMinutes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "estimateFrom": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "target": {
                    "type": "number"
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "down",
                      "up"
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "target",
                  "direction"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "v",
              "type",
              "entityId",
              "op",
              "value"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "ha_calendar"
              },
              "entityId": {
                "type": "string",
                "minLength": 1
              },
              "summaryMatch": {
                "type": "string"
              },
              "offsetDays": {
                "type": "integer",
                "minimum": -366,
                "maximum": 366
              },
              "time": {
                "type": "string",
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
              },
              "autoComplete": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "counter_reset"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "minDrop": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "minDrop"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_change"
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "type",
                        "entityId",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "v",
              "type",
              "entityId",
              "offsetDays"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "one_off"
              },
              "date": {
                "type": "string"
              }
            },
            "required": [
              "v",
              "type",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "kept_bill"
              },
              "billId": {
                "type": "string",
                "minLength": 1
              },
              "dueDate": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "paid",
                  "cancelled",
                  "overdue"
                ]
              }
            },
            "required": [
              "v",
              "type",
              "billId",
              "dueDate",
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "v": {
                "type": "number",
                "const": 1
              },
              "type": {
                "type": "string",
                "const": "warranty"
              },
              "until": {
                "type": "string"
              },
              "extendedUntil": {
                "type": "string"
              },
              "leadDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 3650
              }
            },
            "required": [
              "v",
              "type",
              "until"
            ],
            "additionalProperties": false
          }
        ]
      },
      "NextAppointment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "allDay": {
            "type": "boolean"
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "startDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "allDay",
          "startsAt",
          "startDate"
        ],
        "additionalProperties": false
      },
      "TaskState": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "open",
              "due",
              "overdue",
              "snoozed",
              "unknown"
            ]
          },
          "dueDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "dueKind": {
            "type": "string",
            "enum": [
              "exact",
              "deadline",
              "estimated",
              "condition",
              "none"
            ]
          },
          "occurrenceKey": {
            "type": "string"
          },
          "windowStart": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "progress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "current": {
                    "type": "number"
                  },
                  "target": {
                    "type": "number"
                  },
                  "unit": {
                    "type": "string"
                  }
                },
                "required": [
                  "current",
                  "target"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "estimate": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "confidence": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium"
                    ]
                  }
                },
                "required": [
                  "date",
                  "confidence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "missedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "never_completed",
                "completed",
                "skipped",
                "snoozed",
                "seasonal_boundary",
                "missed_occurrences",
                "period_satisfied",
                "missed_previous_period",
                "signal_missing",
                "signal_stale",
                "signal_unavailable",
                "baseline_missing",
                "counter_reset",
                "condition_pending",
                "condition_active",
                "acknowledged",
                "estimate_from_history",
                "no_upcoming_events",
                "no_occurrences",
                "bill_cancelled",
                "bill_overdue",
                "warranty_expired",
                "expired_archive"
              ]
            }
          },
          "currentAssigneeUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evaluatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "status",
          "dueDate",
          "dueKind",
          "occurrenceKey",
          "windowStart",
          "progress",
          "estimate",
          "missedCount",
          "reasons",
          "currentAssigneeUserId",
          "evaluatedAt"
        ],
        "additionalProperties": false
      },
      "DueResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "open",
              "due",
              "overdue",
              "snoozed",
              "unknown"
            ]
          },
          "dueDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "dueKind": {
            "type": "string",
            "enum": [
              "exact",
              "deadline",
              "estimated",
              "condition",
              "none"
            ]
          },
          "windowStart": {
            "type": "string",
            "format": "date"
          },
          "occurrenceKey": {
            "type": "string"
          },
          "progress": {
            "type": "object",
            "properties": {
              "current": {
                "type": "number"
              },
              "target": {
                "type": "number"
              },
              "unit": {
                "type": "string"
              }
            },
            "required": [
              "current",
              "target"
            ],
            "additionalProperties": false
          },
          "estimate": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "format": "date"
              },
              "confidence": {
                "type": "string",
                "enum": [
                  "low",
                  "medium"
                ]
              }
            },
            "required": [
              "date",
              "confidence"
            ],
            "additionalProperties": false
          },
          "missedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "never_completed",
                "completed",
                "skipped",
                "snoozed",
                "seasonal_boundary",
                "missed_occurrences",
                "period_satisfied",
                "missed_previous_period",
                "signal_missing",
                "signal_stale",
                "signal_unavailable",
                "baseline_missing",
                "counter_reset",
                "condition_pending",
                "condition_active",
                "acknowledged",
                "estimate_from_history",
                "no_upcoming_events",
                "no_occurrences",
                "bill_cancelled",
                "bill_overdue",
                "warranty_expired",
                "expired_archive"
              ]
            }
          }
        },
        "required": [
          "status",
          "dueDate",
          "dueKind",
          "occurrenceKey",
          "reasons"
        ],
        "additionalProperties": false
      },
      "TaskDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "descriptionMd": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "cleaning",
              "maintenance",
              "filter",
              "plant",
              "waste",
              "inspection",
              "payment",
              "order",
              "warranty",
              "defect",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high"
            ]
          },
          "effortMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "trigger": {
            "$ref": "#/components/schemas/Trigger"
          },
          "assignMode": {
            "type": "string",
            "enum": [
              "none",
              "fixed",
              "rotate"
            ]
          },
          "assigneeUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rotationOrder": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rotationStrategy": {
            "type": "string",
            "enum": [
              "alternate",
              "fair"
            ]
          },
          "notifyMode": {
            "type": "string",
            "enum": [
              "assignee",
              "all"
            ]
          },
          "graceDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "dueSoonDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "snoozedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "seed",
              "kept",
              "paperless",
              "ha",
              "mcp",
              "system"
            ]
          },
          "externalSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "openNoteCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextAppointment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NextAppointment"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskState"
              },
              {
                "type": "null"
              }
            ]
          },
          "preparations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Preparation"
            }
          },
          "recentCompletions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Completion"
            }
          }
        },
        "required": [
          "id",
          "title",
          "descriptionMd",
          "category",
          "priority",
          "effortMinutes",
          "assetId",
          "assetName",
          "roomId",
          "roomName",
          "trigger",
          "assignMode",
          "assigneeUserId",
          "rotationOrder",
          "rotationStrategy",
          "notifyMode",
          "graceDays",
          "dueSoonDays",
          "snoozedUntil",
          "archivedAt",
          "source",
          "externalSource",
          "externalRef",
          "externalUrl",
          "createdBy",
          "commentCount",
          "openNoteCount",
          "nextAppointment",
          "createdAt",
          "updatedAt",
          "state",
          "preparations",
          "recentCompletions"
        ],
        "additionalProperties": false
      },
      "Preparation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "taskId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "generic",
              "order_part"
            ]
          },
          "leadDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "leadValue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "op": {
                    "type": "string",
                    "enum": [
                      "eq",
                      "ne",
                      "gt",
                      "gte",
                      "lt",
                      "lte"
                    ]
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 255
                      },
                      {
                        "type": "number"
                      }
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "op",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "partId": {
            "type": [
              "string",
              "null"
            ]
          },
          "qty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "state": {
            "type": "string",
            "enum": [
              "not_yet",
              "now",
              "done",
              "in_stock_skip"
            ]
          }
        },
        "required": [
          "id",
          "taskId",
          "title",
          "kind",
          "leadDays",
          "leadValue",
          "partId",
          "qty",
          "sortOrder",
          "state"
        ],
        "additionalProperties": false
      },
      "Completion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "taskId": {
            "type": "string"
          },
          "taskTitle": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "done",
              "skipped"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "qr",
              "api",
              "mcp",
              "ha",
              "notification",
              "kept",
              "system"
            ]
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedDate": {
            "type": "string",
            "format": "date"
          },
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "counterValue": {
            "type": [
              "number",
              "null"
            ]
          },
          "occurrenceKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueDateAtCompletion": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "taskId",
          "taskTitle",
          "kind",
          "source",
          "completedAt",
          "completedDate",
          "userId",
          "userName",
          "counterValue",
          "occurrenceKey",
          "dueDateAtCompletion",
          "note",
          "revokedAt",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "ServiceLogEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "assetName": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "kind": {
            "type": "string",
            "enum": [
              "maintenance",
              "repair",
              "installation",
              "inspection",
              "replacement",
              "other"
            ]
          },
          "title": {
            "type": "string"
          },
          "descriptionMd": {
            "type": "string"
          },
          "contactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "contactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "completionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costMinor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "costEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costs": {
            "$ref": "#/components/schemas/CostsOf"
          },
          "odometer": {
            "type": [
              "number",
              "null"
            ]
          },
          "performedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "assetName",
          "date",
          "kind",
          "title",
          "descriptionMd",
          "contactId",
          "contactName",
          "completionId",
          "costMinor",
          "currency",
          "costEntryId",
          "costs",
          "odometer",
          "performedBy",
          "createdBy",
          "commentCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostsOf": {
        "type": "object",
        "properties": {
          "totalMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "count": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "totalMinor",
          "count"
        ],
        "additionalProperties": false
      },
      "Dashboard": {
        "type": "object",
        "properties": {
          "today": {
            "type": "string",
            "format": "date"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "counts": {
            "type": "object",
            "properties": {
              "overdue": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "today": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "thisWeek": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "preparations": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "overdue",
              "today",
              "thisWeek",
              "preparations"
            ],
            "additionalProperties": false
          },
          "upcoming": {
            "type": "object",
            "properties": {
              "overdue": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DashboardTask"
                }
              },
              "today": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DashboardTask"
                }
              },
              "thisWeek": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DashboardTask"
                }
              },
              "later": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DashboardTask"
                }
              },
              "signalBased": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DashboardTask"
                }
              }
            },
            "required": [
              "overdue",
              "today",
              "thisWeek",
              "later",
              "signalBased"
            ],
            "additionalProperties": false
          },
          "preparations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardPreparation"
            }
          },
          "recentCompletions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Completion"
            }
          },
          "openDefects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardDefect"
            }
          },
          "expiringWarranties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardWarranty"
            }
          },
          "orderNow": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderNowItem"
            }
          },
          "costsYearToDate": {
            "$ref": "#/components/schemas/DashboardCosts"
          },
          "balances": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DashboardBalances"
              },
              {
                "type": "null"
              }
            ]
          },
          "budgetAlerts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DashboardBudgetAlerts"
              },
              {
                "type": "null"
              }
            ]
          },
          "pendingFinanceSuggestions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reviewNeededCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "pendingReceiptCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "today",
          "generatedAt",
          "counts",
          "upcoming",
          "preparations",
          "recentCompletions",
          "openDefects",
          "expiringWarranties",
          "orderNow",
          "costsYearToDate",
          "balances",
          "budgetAlerts",
          "pendingFinanceSuggestions",
          "reviewNeededCount",
          "pendingReceiptCount"
        ],
        "additionalProperties": false
      },
      "DashboardTask": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "cleaning",
              "maintenance",
              "filter",
              "plant",
              "waste",
              "inspection",
              "payment",
              "order",
              "warranty",
              "defect",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "assigneeUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assigneeName": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "open",
              "due",
              "overdue",
              "snoozed",
              "unknown"
            ]
          },
          "dueKind": {
            "type": "string",
            "enum": [
              "exact",
              "deadline",
              "estimated",
              "condition",
              "none"
            ]
          },
          "date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "estimated": {
            "type": "boolean"
          },
          "estimate": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "confidence": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium"
                    ]
                  }
                },
                "required": [
                  "date",
                  "confidence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "progress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "current": {
                    "type": "number"
                  },
                  "target": {
                    "type": "number"
                  },
                  "unit": {
                    "type": "string"
                  }
                },
                "required": [
                  "current",
                  "target"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "openNoteCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "odometerAssetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "nextAppointment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NextAppointment"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "taskId",
          "title",
          "category",
          "priority",
          "assetId",
          "assetName",
          "roomId",
          "roomName",
          "assigneeUserId",
          "assigneeName",
          "status",
          "dueKind",
          "date",
          "estimated",
          "estimate",
          "progress",
          "openNoteCount",
          "odometerAssetId",
          "nextAppointment"
        ],
        "additionalProperties": false
      },
      "DashboardPreparation": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string"
          },
          "taskTitle": {
            "type": "string"
          },
          "prepId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "not_yet",
              "now",
              "done",
              "in_stock_skip"
            ]
          },
          "date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "taskId",
          "taskTitle",
          "prepId",
          "title",
          "state",
          "date"
        ],
        "additionalProperties": false
      },
      "DashboardDefect": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "reported",
              "in_progress",
              "fixed",
              "rejected"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "date",
          "number",
          "status",
          "severity",
          "roomName",
          "assetName"
        ],
        "additionalProperties": false
      },
      "DashboardWarranty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "assetId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "expiring",
              "expired"
            ]
          },
          "daysLeft": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "title",
          "date",
          "assetId",
          "status",
          "daysLeft"
        ],
        "additionalProperties": false
      },
      "OrderNowItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "taskId": {
            "type": "string"
          },
          "taskTitle": {
            "type": "string"
          },
          "partId": {
            "type": "string"
          },
          "partName": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "neededBy": {
            "type": "string",
            "format": "date"
          },
          "orderBy": {
            "type": "string",
            "format": "date"
          },
          "late": {
            "type": "boolean"
          },
          "stockCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "shopUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "unitPriceMinor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "date",
          "taskId",
          "taskTitle",
          "partId",
          "partName",
          "quantity",
          "neededBy",
          "orderBy",
          "late",
          "stockCount",
          "supplier",
          "shopUrl",
          "unitPriceMinor",
          "currency"
        ],
        "additionalProperties": false
      },
      "DashboardCosts": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "totalMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byCategory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "enum": [
                    "repair",
                    "utilities",
                    "renewal_fund",
                    "purchase",
                    "mortgage_interest",
                    "mortgage_principal",
                    "insurance",
                    "renovation",
                    "maintenance",
                    "fuel",
                    "taxes_fees",
                    "groceries",
                    "household",
                    "dining",
                    "leisure",
                    "travel",
                    "health",
                    "gifts",
                    "transport",
                    "subscriptions",
                    "other"
                  ]
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "category",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byBook": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "bookId": {
                  "type": "string"
                },
                "bookName": {
                  "type": "string"
                },
                "taxRelevant": {
                  "type": "boolean"
                },
                "archived": {
                  "type": "boolean"
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "bookId",
                "bookName",
                "taxRelevant",
                "archived",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "year",
          "currency",
          "totalMinor",
          "byCategory",
          "byBook"
        ],
        "additionalProperties": false
      },
      "DashboardBalances": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "myBalanceMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "hasActivity": {
            "type": "boolean"
          },
          "suggestedPayments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fromUserId": {
                  "type": "string"
                },
                "fromName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toUserId": {
                  "type": "string"
                },
                "toName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "fromUserId",
                "fromName",
                "toUserId",
                "toName",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          },
          "suggestedPaymentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "currency",
          "myBalanceMinor",
          "hasActivity",
          "suggestedPayments",
          "suggestedPaymentCount"
        ],
        "additionalProperties": false
      },
      "DashboardBudgetAlerts": {
        "type": "object",
        "properties": {
          "exceeded": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "warning": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "top": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardBudgetAlert"
            }
          }
        },
        "required": [
          "exceeded",
          "warning",
          "top"
        ],
        "additionalProperties": false
      },
      "DashboardBudgetAlert": {
        "type": "object",
        "properties": {
          "budgetId": {
            "type": "string"
          },
          "bookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookName": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "repair",
                  "utilities",
                  "renewal_fund",
                  "purchase",
                  "mortgage_interest",
                  "mortgage_principal",
                  "insurance",
                  "renovation",
                  "maintenance",
                  "fuel",
                  "taxes_fees",
                  "groceries",
                  "household",
                  "dining",
                  "leisure",
                  "travel",
                  "health",
                  "gifts",
                  "transport",
                  "subscriptions",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "period": {
            "type": "string",
            "enum": [
              "month",
              "year"
            ]
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "spentMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "percentUsed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "state": {
            "type": "string",
            "enum": [
              "warning",
              "exceeded"
            ]
          }
        },
        "required": [
          "budgetId",
          "bookId",
          "bookName",
          "category",
          "period",
          "amountMinor",
          "spentMinor",
          "currency",
          "percentUsed",
          "state"
        ],
        "additionalProperties": false
      },
      "Stats": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "total": {
            "$ref": "#/components/schemas/GroupStats"
          },
          "byUser": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/GroupStats"
            }
          },
          "byCategory": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/GroupStats"
            }
          }
        },
        "required": [
          "from",
          "to",
          "total",
          "byUser",
          "byCategory"
        ],
        "additionalProperties": false
      },
      "GroupStats": {
        "type": "object",
        "properties": {
          "done": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "skipped": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "onTime": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "measurable": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "onTimeShare": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "done",
          "skipped",
          "onTime",
          "measurable",
          "onTimeShare"
        ],
        "additionalProperties": false
      },
      "Notification": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "prep",
              "due_soon",
              "due",
              "overdue",
              "digest",
              "info",
              "comment",
              "hint"
            ]
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "titleKey": {
            "type": "string",
            "enum": [
              "notification_prep",
              "notification_due_soon",
              "notification_due",
              "notification_due_soon_notes",
              "notification_due_notes",
              "notification_overdue",
              "notification_digest",
              "notification_info",
              "notification_comment",
              "notification_hint"
            ]
          },
          "params": {
            "$ref": "#/components/schemas/NotificationParams"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "readAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "taskId",
          "titleKey",
          "params",
          "url",
          "createdAt",
          "readAt"
        ],
        "additionalProperties": false
      },
      "NotificationParams": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": [
            "string",
            "number"
          ]
        }
      },
      "Household": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "handoverDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/HouseholdSettings"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "name",
          "timezone",
          "currency",
          "handoverDate",
          "settings",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "HouseholdSettings": {
        "type": "object",
        "properties": {
          "dueSoonDays": {
            "default": 7,
            "type": "integer",
            "minimum": 0,
            "maximum": 60
          },
          "digestTime": {
            "default": "08:00",
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "defectDeadlineMonths": {
            "default": 24,
            "type": "integer",
            "minimum": 1,
            "maximum": 120
          },
          "integrationHostAllowlist": {
            "description": "Hosts (`host` or `host:port`, normalised) that members may point their own (per-person) integration connections at. Administrators may use any host. Shown to administrators only.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "dueSoonDays",
          "digestTime",
          "defectDeadlineMonths"
        ],
        "additionalProperties": false
      },
      "DirectoryUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "ownershipBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        },
        "required": [
          "id",
          "displayName",
          "ownershipBps"
        ],
        "additionalProperties": false
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "installer",
              "property_mgmt",
              "manufacturer_support",
              "emergency",
              "utility",
              "insurance",
              "neighbor",
              "seller",
              "other"
            ]
          },
          "name": {
            "type": "string"
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "emergency": {
            "type": "boolean"
          },
          "guestVisible": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "externalSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "company",
          "phone",
          "email",
          "url",
          "address",
          "notes",
          "emergency",
          "guestVisible",
          "sortOrder",
          "externalSource",
          "externalRef",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ContactDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "installer",
              "property_mgmt",
              "manufacturer_support",
              "emergency",
              "utility",
              "insurance",
              "neighbor",
              "seller",
              "other"
            ]
          },
          "name": {
            "type": "string"
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "emergency": {
            "type": "boolean"
          },
          "guestVisible": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "externalSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "assets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "linkId": {
                  "type": "string"
                },
                "assetId": {
                  "type": "string"
                },
                "assetName": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "support",
                    "installer",
                    "seller",
                    "service",
                    "other"
                  ]
                }
              },
              "required": [
                "linkId",
                "assetId",
                "assetName",
                "role"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "company",
          "phone",
          "email",
          "url",
          "address",
          "notes",
          "emergency",
          "guestVisible",
          "sortOrder",
          "externalSource",
          "externalRef",
          "createdAt",
          "updatedAt",
          "assets"
        ],
        "additionalProperties": false
      },
      "AssetContact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "contactId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "support",
              "installer",
              "seller",
              "service",
              "other"
            ]
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          }
        },
        "required": [
          "id",
          "assetId",
          "contactId",
          "role",
          "contact"
        ],
        "additionalProperties": false
      },
      "Part": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "partNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "shopUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "unitPriceMinor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          },
          "stockCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "minStock": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reorderQty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "leadTimeDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "orderedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedQty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lowStock": {
            "type": "boolean"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "partNumber",
          "supplier",
          "shopUrl",
          "unitPriceMinor",
          "currency",
          "stockCount",
          "minStock",
          "reorderQty",
          "leadTimeDays",
          "orderedAt",
          "orderedQty",
          "lowStock",
          "notes",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "PartDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "partNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "shopUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "unitPriceMinor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          },
          "stockCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "minStock": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reorderQty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "leadTimeDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "orderedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedQty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lowStock": {
            "type": "boolean"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "assets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "qty": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "title",
                "qty"
              ],
              "additionalProperties": false
            }
          },
          "recentMovements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartMovement"
            }
          }
        },
        "required": [
          "id",
          "name",
          "partNumber",
          "supplier",
          "shopUrl",
          "unitPriceMinor",
          "currency",
          "stockCount",
          "minStock",
          "reorderQty",
          "leadTimeDays",
          "orderedAt",
          "orderedQty",
          "lowStock",
          "notes",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "assets",
          "tasks",
          "recentMovements"
        ],
        "additionalProperties": false
      },
      "PartMovement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "partId": {
            "type": "string"
          },
          "delta": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reason": {
            "type": "string",
            "enum": [
              "used",
              "bought",
              "correction"
            ]
          },
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "completionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "partId",
          "delta",
          "reason",
          "userId",
          "userName",
          "completionId",
          "note",
          "at"
        ],
        "additionalProperties": false
      },
      "AssetPart": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string"
          },
          "partId": {
            "type": "string"
          },
          "part": {
            "$ref": "#/components/schemas/Part"
          }
        },
        "required": [
          "assetId",
          "partId",
          "part"
        ],
        "additionalProperties": false
      },
      "TaskPart": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string"
          },
          "partId": {
            "type": "string"
          },
          "qty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "part": {
            "$ref": "#/components/schemas/Part"
          }
        },
        "required": [
          "taskId",
          "partId",
          "qty",
          "part"
        ],
        "additionalProperties": false
      },
      "Vehicle": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string"
          },
          "plate": {
            "type": [
              "string",
              "null"
            ]
          },
          "vin": {
            "type": [
              "string",
              "null"
            ]
          },
          "registrationNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstRegistration": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "fuelType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "petrol",
                  "diesel",
                  "electric",
                  "hybrid",
                  "plugin_hybrid",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "tireSizeSummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "tireSizeWinter": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "odometerUnit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "costBookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "odometer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OdometerSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "assetId",
          "plate",
          "vin",
          "registrationNumber",
          "firstRegistration",
          "fuelType",
          "tireSizeSummer",
          "tireSizeWinter",
          "location",
          "odometerUnit",
          "notes",
          "costBookId",
          "odometer",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "VehicleStats": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string"
          },
          "year": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "from": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "to": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "odometerUnit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          },
          "distance": {
            "type": "number"
          },
          "distanceByMonth": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "type": "string"
                },
                "distance": {
                  "type": "number"
                }
              },
              "required": [
                "month",
                "distance"
              ],
              "additionalProperties": false
            }
          },
          "costs": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string"
              },
              "totalMinor": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "otherCurrencyCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "byCategory": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "category": {
                      "type": "string",
                      "enum": [
                        "repair",
                        "utilities",
                        "renewal_fund",
                        "purchase",
                        "mortgage_interest",
                        "mortgage_principal",
                        "insurance",
                        "renovation",
                        "maintenance",
                        "fuel",
                        "taxes_fees",
                        "groceries",
                        "household",
                        "dining",
                        "leisure",
                        "travel",
                        "health",
                        "gifts",
                        "transport",
                        "subscriptions",
                        "other"
                      ]
                    },
                    "totalMinor": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "count": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "category",
                    "totalMinor",
                    "count"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "currency",
              "totalMinor",
              "count",
              "otherCurrencyCount",
              "byCategory"
            ],
            "additionalProperties": false
          },
          "costPerDistanceMinor": {
            "type": [
              "number",
              "null"
            ]
          },
          "consumption": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "unit": {
                  "type": "string",
                  "enum": [
                    "l",
                    "kWh"
                  ]
                },
                "averagePer100": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "stretchCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "last": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "fillId": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string",
                        "format": "date"
                      },
                      "distance": {
                        "type": "number"
                      },
                      "quantity": {
                        "type": "number"
                      },
                      "consumptionPer100": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "fillId",
                      "date",
                      "distance",
                      "quantity",
                      "consumptionPer100"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "unit",
                "averagePer100",
                "stretchCount",
                "last"
              ],
              "additionalProperties": false
            }
          },
          "priceTrend": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fillId": {
                  "type": "string"
                },
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "unit": {
                  "type": "string",
                  "enum": [
                    "l",
                    "kWh"
                  ]
                },
                "pricePerUnitMinor": {
                  "type": "number"
                }
              },
              "required": [
                "fillId",
                "date",
                "unit",
                "pricePerUnitMinor"
              ],
              "additionalProperties": false
            }
          },
          "tireSet": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TireSet"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextTasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardTask"
            }
          }
        },
        "required": [
          "assetId",
          "year",
          "from",
          "to",
          "odometerUnit",
          "distance",
          "distanceByMonth",
          "costs",
          "costPerDistanceMinor",
          "consumption",
          "priceTrend",
          "tireSet",
          "nextTasks"
        ],
        "additionalProperties": false
      },
      "TireSet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "season": {
            "type": "string",
            "enum": [
              "summer",
              "winter",
              "all_season"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": [
              "string",
              "null"
            ]
          },
          "dot": {
            "type": [
              "string",
              "null"
            ]
          },
          "treadDepthMm": {
            "type": [
              "number",
              "null"
            ]
          },
          "treadMeasuredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "treadWarning": {
            "type": "boolean"
          },
          "ageYears": {
            "type": [
              "number",
              "null"
            ]
          },
          "storageLocation": {
            "type": [
              "string",
              "null"
            ]
          },
          "storageContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "storageContactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "mounted": {
            "type": "boolean"
          },
          "mountedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "purchasedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "retiredAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "distance": {
            "type": [
              "number",
              "null"
            ]
          },
          "odometerUnit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "season",
          "brand",
          "model",
          "size",
          "dot",
          "treadDepthMm",
          "treadMeasuredOn",
          "treadWarning",
          "ageYears",
          "storageLocation",
          "storageContactId",
          "storageContactName",
          "mounted",
          "mountedOn",
          "purchasedOn",
          "retiredAt",
          "notes",
          "distance",
          "odometerUnit",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "FuelLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "odometer": {
            "type": "number"
          },
          "odometerUnit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          },
          "quantity": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "enum": [
              "l",
              "kWh"
            ]
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "fullTank": {
            "type": "boolean"
          },
          "missedPrevious": {
            "type": "boolean"
          },
          "station": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "costEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookName": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricePerUnitMinor": {
            "type": [
              "number",
              "null"
            ]
          },
          "distance": {
            "type": [
              "number",
              "null"
            ]
          },
          "consumptionPer100": {
            "type": [
              "number",
              "null"
            ]
          },
          "costPerDistanceMinor": {
            "type": [
              "number",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "date",
          "odometer",
          "odometerUnit",
          "quantity",
          "unit",
          "amountMinor",
          "currency",
          "fullTank",
          "missedPrevious",
          "station",
          "notes",
          "costEntryId",
          "bookId",
          "bookName",
          "paidByUserId",
          "pricePerUnitMinor",
          "distance",
          "consumptionPer100",
          "costPerDistanceMinor",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "TireSetDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "season": {
            "type": "string",
            "enum": [
              "summer",
              "winter",
              "all_season"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": [
              "string",
              "null"
            ]
          },
          "dot": {
            "type": [
              "string",
              "null"
            ]
          },
          "treadDepthMm": {
            "type": [
              "number",
              "null"
            ]
          },
          "treadMeasuredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "treadWarning": {
            "type": "boolean"
          },
          "ageYears": {
            "type": [
              "number",
              "null"
            ]
          },
          "storageLocation": {
            "type": [
              "string",
              "null"
            ]
          },
          "storageContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "storageContactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "mounted": {
            "type": "boolean"
          },
          "mountedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "purchasedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "retiredAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "distance": {
            "type": [
              "number",
              "null"
            ]
          },
          "odometerUnit": {
            "type": "string",
            "enum": [
              "km",
              "mi"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TireSetEvent"
            }
          }
        },
        "required": [
          "id",
          "assetId",
          "season",
          "brand",
          "model",
          "size",
          "dot",
          "treadDepthMm",
          "treadMeasuredOn",
          "treadWarning",
          "ageYears",
          "storageLocation",
          "storageContactId",
          "storageContactName",
          "mounted",
          "mountedOn",
          "purchasedOn",
          "retiredAt",
          "notes",
          "distance",
          "odometerUnit",
          "createdAt",
          "updatedAt",
          "events"
        ],
        "additionalProperties": false
      },
      "TireSetEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "mounted",
              "unmounted",
              "tread_measured"
            ]
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "odometer": {
            "type": [
              "number",
              "null"
            ]
          },
          "treadDepthMm": {
            "type": [
              "number",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "date",
          "odometer",
          "treadDepthMm",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "OdometerReading": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "value": {
            "type": "number"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "completion",
              "service_log",
              "fuel_log",
              "tire_change"
            ]
          },
          "sourceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "date",
          "value",
          "source",
          "sourceId",
          "note",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bookId": {
            "type": "string"
          },
          "bookName": {
            "type": "string"
          },
          "bookTaxRelevant": {
            "type": "boolean"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "title": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "repair",
              "utilities",
              "renewal_fund",
              "purchase",
              "mortgage_interest",
              "mortgage_principal",
              "insurance",
              "renovation",
              "maintenance",
              "fuel",
              "taxes_fees",
              "groceries",
              "household",
              "dining",
              "leisure",
              "travel",
              "health",
              "gifts",
              "transport",
              "subscriptions",
              "other"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "defectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "defectNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "defectTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "serviceLogId": {
            "type": [
              "string",
              "null"
            ]
          },
          "serviceLogTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "payee": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "splitMode": {
            "type": "string",
            "enum": [
              "ownership",
              "equal",
              "custom",
              "none"
            ]
          },
          "shares": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostShare"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostTagRef"
            }
          },
          "countsAsExpense": {
            "type": "boolean"
          },
          "deductible": {
            "type": "string",
            "enum": [
              "unknown",
              "maintenance",
              "investment",
              "no"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "finance_transaction",
              "finance_bill",
              "recurring"
            ]
          },
          "providerUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "fuelLogId": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewNeeded": {
            "type": "boolean"
          },
          "reviewedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "reviewedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "receiptTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "financeLinked": {
            "type": "boolean"
          },
          "recurrenceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bookId",
          "bookName",
          "bookTaxRelevant",
          "date",
          "title",
          "amountMinor",
          "currency",
          "category",
          "assetId",
          "assetName",
          "roomId",
          "roomName",
          "defectId",
          "defectNumber",
          "defectTitle",
          "serviceLogId",
          "serviceLogTitle",
          "payee",
          "notes",
          "paidByUserId",
          "paidByName",
          "splitMode",
          "shares",
          "tags",
          "countsAsExpense",
          "deductible",
          "source",
          "providerUrl",
          "fuelLogId",
          "reviewNeeded",
          "reviewedAt",
          "reviewedByUserId",
          "receiptTaskId",
          "financeLinked",
          "recurrenceId",
          "commentCount",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostShare": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shareBps": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "userId",
          "userName",
          "shareBps",
          "amountMinor"
        ],
        "additionalProperties": false
      },
      "CostTagRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "enum": [
              "gray",
              "red",
              "orange",
              "amber",
              "green",
              "teal",
              "blue",
              "violet",
              "pink"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "color"
        ],
        "additionalProperties": false
      },
      "CostsSummary": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "otherCurrencyCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "expenseTotalMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "equityTotalMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byCategory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "enum": [
                    "repair",
                    "utilities",
                    "renewal_fund",
                    "purchase",
                    "mortgage_interest",
                    "mortgage_principal",
                    "insurance",
                    "renovation",
                    "maintenance",
                    "fuel",
                    "taxes_fees",
                    "groceries",
                    "household",
                    "dining",
                    "leisure",
                    "travel",
                    "health",
                    "gifts",
                    "transport",
                    "subscriptions",
                    "other"
                  ]
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "category",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byMonth": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "type": "string"
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "month",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byAsset": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "assetId": {
                  "type": "string"
                },
                "assetName": {
                  "type": "string"
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "assetId",
                "assetName",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byDeductible": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "deductible": {
                  "type": "string",
                  "enum": [
                    "unknown",
                    "maintenance",
                    "investment",
                    "no"
                  ]
                },
                "totalMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "deductible",
                "totalMinor",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "people": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string"
                },
                "userName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paidMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "shareMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "balanceMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "userId",
                "userName",
                "paidMinor",
                "shareMinor",
                "balanceMinor"
              ],
              "additionalProperties": false
            }
          },
          "settlement": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fromUserId": {
                  "type": "string"
                },
                "fromName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toUserId": {
                  "type": "string"
                },
                "toName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "fromUserId",
                "fromName",
                "toUserId",
                "toName",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          },
          "unassignedPayerCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reviewNeededCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "year",
          "currency",
          "otherCurrencyCount",
          "expenseTotalMinor",
          "equityTotalMinor",
          "byCategory",
          "byMonth",
          "byAsset",
          "byDeductible",
          "people",
          "settlement",
          "unassignedPayerCount",
          "reviewNeededCount"
        ],
        "additionalProperties": false
      },
      "RecentCategories": {
        "type": "object",
        "properties": {
          "entriesPerBook": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "bookId": {
                  "type": "string"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "repair",
                    "utilities",
                    "renewal_fund",
                    "purchase",
                    "mortgage_interest",
                    "mortgage_principal",
                    "insurance",
                    "renovation",
                    "maintenance",
                    "fuel",
                    "taxes_fees",
                    "groceries",
                    "household",
                    "dining",
                    "leisure",
                    "travel",
                    "health",
                    "gifts",
                    "transport",
                    "subscriptions",
                    "other"
                  ]
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "bookId",
                "category",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "entriesPerBook",
          "items"
        ],
        "additionalProperties": false
      },
      "MoveCostsToBookResult": {
        "type": "object",
        "properties": {
          "bookId": {
            "type": "string"
          },
          "moved": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unchanged": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "deductibleReset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "dryRun": {
            "type": "boolean"
          },
          "years": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "to": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "bookId",
          "moved",
          "unchanged",
          "deductibleReset",
          "dryRun",
          "years"
        ],
        "additionalProperties": false
      },
      "CostBalances": {
        "type": "object",
        "properties": {
          "book": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          },
          "otherCurrencyCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unassignedPayerCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "people": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string"
                },
                "userName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paidMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "shareMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "sentMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "receivedMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "balanceMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "userId",
                "userName",
                "paidMinor",
                "shareMinor",
                "sentMinor",
                "receivedMinor",
                "balanceMinor"
              ],
              "additionalProperties": false
            }
          },
          "crossBookSettlements": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "totalMinor": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "count",
                  "totalMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "suggestedPayments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fromUserId": {
                  "type": "string"
                },
                "fromName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toUserId": {
                  "type": "string"
                },
                "toName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "fromUserId",
                "fromName",
                "toUserId",
                "toName",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "book",
          "currency",
          "otherCurrencyCount",
          "unassignedPayerCount",
          "people",
          "crossBookSettlements",
          "suggestedPayments"
        ],
        "additionalProperties": false
      },
      "CostBook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultSplitMode": {
            "type": "string",
            "enum": [
              "ownership",
              "equal",
              "none"
            ]
          },
          "taxRelevant": {
            "type": "boolean"
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "isDefault": {
            "type": "boolean"
          },
          "entryCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "settlementCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "icon",
          "defaultSplitMode",
          "taxRelevant",
          "archivedAt",
          "sortOrder",
          "isDefault",
          "entryCount",
          "settlementCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostTag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "enum": [
              "gray",
              "red",
              "orange",
              "amber",
              "green",
              "teal",
              "blue",
              "violet",
              "pink"
            ]
          },
          "entryCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "color",
          "entryCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostBudget": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookName": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "repair",
                  "utilities",
                  "renewal_fund",
                  "purchase",
                  "mortgage_interest",
                  "mortgage_principal",
                  "insurance",
                  "renovation",
                  "maintenance",
                  "fuel",
                  "taxes_fees",
                  "groceries",
                  "household",
                  "dining",
                  "leisure",
                  "travel",
                  "health",
                  "gifts",
                  "transport",
                  "subscriptions",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "period": {
            "type": "string",
            "enum": [
              "month",
              "year"
            ]
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bookId",
          "bookName",
          "category",
          "period",
          "amountMinor",
          "currency",
          "active",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostBudgetStatus": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "month": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "warningPercent": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostBudgetStatusItem"
            }
          }
        },
        "required": [
          "year",
          "month",
          "currency",
          "warningPercent",
          "items"
        ],
        "additionalProperties": false
      },
      "CostBudgetStatusItem": {
        "type": "object",
        "properties": {
          "budget": {
            "$ref": "#/components/schemas/CostBudget"
          },
          "periodFrom": {
            "type": "string",
            "format": "date"
          },
          "periodTo": {
            "type": "string",
            "format": "date"
          },
          "spentMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "entryCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "remainingMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "percentUsed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "state": {
            "type": "string",
            "enum": [
              "ok",
              "warning",
              "exceeded"
            ]
          }
        },
        "required": [
          "budget",
          "periodFrom",
          "periodTo",
          "spentMinor",
          "entryCount",
          "remainingMinor",
          "percentUsed",
          "state"
        ],
        "additionalProperties": false
      },
      "CostRecurrence": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bookId": {
            "type": "string"
          },
          "bookName": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "repair",
              "utilities",
              "renewal_fund",
              "purchase",
              "mortgage_interest",
              "mortgage_principal",
              "insurance",
              "renovation",
              "maintenance",
              "fuel",
              "taxes_fees",
              "groceries",
              "household",
              "dining",
              "leisure",
              "travel",
              "health",
              "gifts",
              "transport",
              "subscriptions",
              "other"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "payee": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "splitMode": {
            "type": "string",
            "enum": [
              "ownership",
              "equal",
              "custom",
              "none"
            ]
          },
          "shares": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "shareBps": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  },
                  "required": [
                    "userId",
                    "shareBps"
                  ],
                  "additionalProperties": false
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "participantIds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostTagRef"
            }
          },
          "countsAsExpense": {
            "type": "boolean"
          },
          "deductible": {
            "type": "string",
            "enum": [
              "unknown",
              "maintenance",
              "investment",
              "no"
            ]
          },
          "frequency": {
            "type": "string",
            "enum": [
              "monthly",
              "quarterly",
              "yearly"
            ]
          },
          "interval": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "dayOfMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastOccurrenceDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "active": {
            "type": "boolean"
          },
          "lastError": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "book_archived",
                  "failed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bookId",
          "bookName",
          "title",
          "amountMinor",
          "currency",
          "category",
          "assetId",
          "assetName",
          "roomId",
          "roomName",
          "payee",
          "notes",
          "paidByUserId",
          "paidByName",
          "splitMode",
          "shares",
          "participantIds",
          "tags",
          "countsAsExpense",
          "deductible",
          "frequency",
          "interval",
          "dayOfMonth",
          "startDate",
          "endDate",
          "nextDate",
          "lastOccurrenceDate",
          "active",
          "lastError",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CostRecurrenceRun": {
        "type": "object",
        "properties": {
          "recurrence": {
            "$ref": "#/components/schemas/CostRecurrence"
          },
          "entry": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CostEntry"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "recurrence",
          "entry"
        ],
        "additionalProperties": false
      },
      "Settlement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookName": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromUserId": {
            "type": "string"
          },
          "fromName": {
            "type": [
              "string",
              "null"
            ]
          },
          "toUserId": {
            "type": "string"
          },
          "toName": {
            "type": [
              "string",
              "null"
            ]
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bookId",
          "bookName",
          "fromUserId",
          "fromName",
          "toUserId",
          "toName",
          "amountMinor",
          "currency",
          "date",
          "note",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "FinanceSuggestion": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "dismissed"
                ]
              },
              "acceptedEntityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "const": "cost"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "finance_transaction",
                      "finance_bill"
                    ]
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "payee": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "repair",
                      "utilities",
                      "renewal_fund",
                      "purchase",
                      "mortgage_interest",
                      "mortgage_principal",
                      "insurance",
                      "renovation",
                      "maintenance",
                      "fuel",
                      "taxes_fees",
                      "groceries",
                      "household",
                      "dining",
                      "leisure",
                      "travel",
                      "health",
                      "gifts",
                      "transport",
                      "subscriptions",
                      "other"
                    ]
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "assetId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "bookId": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "source",
                  "date",
                  "amountMinor",
                  "currency",
                  "title",
                  "payee",
                  "category",
                  "url",
                  "assetId",
                  "bookId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "status",
              "acceptedEntityId",
              "createdAt",
              "updatedAt",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "dismissed"
                ]
              },
              "acceptedEntityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "const": "asset"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "purchaseDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "priceMinor": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "type": "string"
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "purchaseDate",
                  "priceMinor",
                  "currency",
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "status",
              "acceptedEntityId",
              "createdAt",
              "updatedAt",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "dismissed"
                ]
              },
              "acceptedEntityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "const": "bill_task"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "dueDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "amountMinor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string"
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "title",
                  "dueDate",
                  "amountMinor",
                  "currency",
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "status",
              "acceptedEntityId",
              "createdAt",
              "updatedAt",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "dismissed"
                ]
              },
              "acceptedEntityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "const": "link"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "entryId": {
                    "type": "string"
                  },
                  "entry": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/FinanceLinkedEntry"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "transaction": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "enum": [
                          "finance_transaction",
                          "finance_bill"
                        ]
                      },
                      "date": {
                        "type": "string",
                        "format": "date"
                      },
                      "amountMinor": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "payee": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "category": {
                        "type": "string",
                        "enum": [
                          "repair",
                          "utilities",
                          "renewal_fund",
                          "purchase",
                          "mortgage_interest",
                          "mortgage_principal",
                          "insurance",
                          "renovation",
                          "maintenance",
                          "fuel",
                          "taxes_fees",
                          "groceries",
                          "household",
                          "dining",
                          "leisure",
                          "travel",
                          "health",
                          "gifts",
                          "transport",
                          "subscriptions",
                          "other"
                        ]
                      },
                      "url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "assetId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "bookId": {
                        "default": null,
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "date",
                      "amountMinor",
                      "currency",
                      "title",
                      "payee",
                      "category",
                      "url",
                      "assetId",
                      "bookId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "entryId",
                  "entry",
                  "transaction"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "status",
              "acceptedEntityId",
              "createdAt",
              "updatedAt",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          }
        ]
      },
      "FinanceLinkedEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "payee": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookId": {
            "type": "string"
          },
          "bookName": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "date",
          "amountMinor",
          "currency",
          "payee",
          "bookId",
          "bookName"
        ],
        "additionalProperties": false
      },
      "FinanceSuggestionAccepted": {
        "type": "object",
        "properties": {
          "suggestion": {
            "$ref": "#/components/schemas/FinanceSuggestion"
          },
          "entity": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "cost",
                  "asset",
                  "task"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "suggestion",
          "entity"
        ],
        "additionalProperties": false
      },
      "FinanceSync": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "stats": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          }
        },
        "required": [
          "ok",
          "error",
          "stats"
        ],
        "additionalProperties": false
      },
      "Defect": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "descriptionMd": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "reported",
              "in_progress",
              "fixed",
              "rejected"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "locationDetail": {
            "type": [
              "string",
              "null"
            ]
          },
          "discoveredOn": {
            "type": "string",
            "format": "date"
          },
          "reportedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "responsibleContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "responsibleContactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "deadlineDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "deadlineSource": {
            "type": "string",
            "enum": [
              "manual",
              "handover"
            ]
          },
          "fixedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionMd": {
            "type": "string"
          },
          "costEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costs": {
            "$ref": "#/components/schemas/CostsOf"
          },
          "reminderTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "number",
          "title",
          "descriptionMd",
          "status",
          "severity",
          "roomId",
          "roomName",
          "assetId",
          "assetName",
          "locationDetail",
          "discoveredOn",
          "reportedOn",
          "responsibleContactId",
          "responsibleContactName",
          "deadlineDate",
          "deadlineSource",
          "fixedOn",
          "resolutionMd",
          "costEntryId",
          "costs",
          "reminderTaskId",
          "commentCount",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "DefectDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "descriptionMd": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "reported",
              "in_progress",
              "fixed",
              "rejected"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "locationDetail": {
            "type": [
              "string",
              "null"
            ]
          },
          "discoveredOn": {
            "type": "string",
            "format": "date"
          },
          "reportedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "responsibleContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "responsibleContactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "deadlineDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "deadlineSource": {
            "type": "string",
            "enum": [
              "manual",
              "handover"
            ]
          },
          "fixedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionMd": {
            "type": "string"
          },
          "costEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costs": {
            "$ref": "#/components/schemas/CostsOf"
          },
          "reminderTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DefectEvent"
            }
          }
        },
        "required": [
          "id",
          "number",
          "title",
          "descriptionMd",
          "status",
          "severity",
          "roomId",
          "roomName",
          "assetId",
          "assetName",
          "locationDetail",
          "discoveredOn",
          "reportedOn",
          "responsibleContactId",
          "responsibleContactName",
          "deadlineDate",
          "deadlineSource",
          "fixedOn",
          "resolutionMd",
          "costEntryId",
          "costs",
          "reminderTaskId",
          "commentCount",
          "createdBy",
          "createdAt",
          "updatedAt",
          "events"
        ],
        "additionalProperties": false
      },
      "DefectEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "defectId": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "created",
              "status",
              "comment",
              "correspondence"
            ]
          },
          "fromStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "open",
                  "reported",
                  "in_progress",
                  "fixed",
                  "rejected"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "toStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "open",
                  "reported",
                  "in_progress",
                  "fixed",
                  "rejected"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "bodyMd": {
            "type": "string"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "defectId",
          "at",
          "userId",
          "userName",
          "type",
          "fromStatus",
          "toStatus",
          "bodyMd",
          "externalRef"
        ],
        "additionalProperties": false
      },
      "DefectTimelineItem": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "event"
              },
              "id": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "userId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "userName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "created",
                  "status",
                  "comment",
                  "correspondence"
                ]
              },
              "fromStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "open",
                      "reported",
                      "in_progress",
                      "fixed",
                      "rejected"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "toStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "open",
                      "reported",
                      "in_progress",
                      "fixed",
                      "rejected"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bodyMd": {
                "type": "string"
              },
              "externalRef": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "id",
              "at",
              "userId",
              "userName",
              "type",
              "fromStatus",
              "toStatus",
              "bodyMd",
              "externalRef"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "comment"
              },
              "id": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "userId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "userName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bodyMd": {
                "type": "string"
              },
              "editedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deleted": {
                "type": "boolean"
              }
            },
            "required": [
              "kind",
              "id",
              "at",
              "userId",
              "userName",
              "bodyMd",
              "editedAt",
              "deleted"
            ],
            "additionalProperties": false
          }
        ]
      },
      "InsurancePolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "motor_liability",
              "motor_partial_casco",
              "motor_full_casco",
              "household",
              "personal_liability",
              "building",
              "legal",
              "travel",
              "health",
              "life",
              "other"
            ]
          },
          "insurerContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "insurerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "policyNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "premiumMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "premiumPeriod": {
            "type": "string",
            "enum": [
              "monthly",
              "quarterly",
              "semiannual",
              "annual"
            ]
          },
          "annualPremiumMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "deductibleMinor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "renewal": {
            "type": "string",
            "enum": [
              "auto",
              "fixed"
            ]
          },
          "cancellationNoticeMonths": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "cancellationDeadline": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "assistancePhone": {
            "type": [
              "string",
              "null"
            ]
          },
          "showOnEmergency": {
            "type": "boolean"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InsurancePolicyAsset"
            }
          },
          "reminderTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "type",
          "insurerContactId",
          "insurerName",
          "policyNumber",
          "premiumMinor",
          "currency",
          "premiumPeriod",
          "annualPremiumMinor",
          "deductibleMinor",
          "startDate",
          "endDate",
          "renewal",
          "cancellationNoticeMonths",
          "cancellationDeadline",
          "assistancePhone",
          "showOnEmergency",
          "notes",
          "assets",
          "reminderTaskId",
          "commentCount",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "InsurancePolicyAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "device",
              "plant",
              "fixture",
              "vehicle",
              "other"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "kind"
        ],
        "additionalProperties": false
      },
      "AssetNote": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "assetName": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "resolvedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolvedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "serviceLogId": {
            "type": [
              "string",
              "null"
            ]
          },
          "defectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "assetName",
          "body",
          "status",
          "resolvedAt",
          "resolvedBy",
          "resolvedByName",
          "serviceLogId",
          "defectId",
          "createdBy",
          "createdByName",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Appointment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "allDay": {
            "type": "boolean"
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "endsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "startDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "endDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "taskTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurrenceKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "contactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "contactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "planned",
              "done",
              "cancelled"
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "notes",
          "location",
          "allDay",
          "startsAt",
          "endsAt",
          "startDate",
          "endDate",
          "taskId",
          "taskTitle",
          "occurrenceKey",
          "assetId",
          "assetName",
          "contactId",
          "contactName",
          "status",
          "commentCount",
          "createdByUserId",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Warranty": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string"
          },
          "assetName": {
            "type": "string"
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "manufacturer": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchaseDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyExtendedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "effectiveUntil": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "expiring",
              "expired"
            ]
          },
          "daysLeft": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "assetId",
          "assetName",
          "roomName",
          "manufacturer",
          "model",
          "purchaseDate",
          "warrantyUntil",
          "warrantyExtendedUntil",
          "effectiveUntil",
          "status",
          "daysLeft"
        ],
        "additionalProperties": false
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityType": {
            "type": "string",
            "enum": [
              "task",
              "defect",
              "asset",
              "room",
              "part",
              "contact",
              "service_log",
              "asset_hint",
              "doc_page",
              "cost",
              "insurance_policy",
              "appointment"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "author": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "bodyMd": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "editedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted": {
            "type": "boolean"
          },
          "canEdit": {
            "type": "boolean"
          },
          "canDelete": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "entityType",
          "entityId",
          "author",
          "bodyMd",
          "createdAt",
          "editedAt",
          "deleted",
          "canEdit",
          "canDelete"
        ],
        "additionalProperties": false
      },
      "Hint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "assetName": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "bodyMd": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "tip",
              "rule",
              "warning"
            ]
          },
          "pinned": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "guestVisible": {
            "type": "boolean"
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "taskTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "reaction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SignalReaction"
              },
              {
                "type": "null"
              }
            ]
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "assetId",
          "assetName",
          "title",
          "bodyMd",
          "kind",
          "pinned",
          "sortOrder",
          "guestVisible",
          "taskId",
          "taskTitle",
          "reaction",
          "commentCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "SignalReaction": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "signal_change"
          },
          "entityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "toState": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "fromState": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "delayMinutes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
          },
          "notify": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "all",
                  "assignee"
                ]
              },
              {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              }
            ]
          }
        },
        "required": [
          "type",
          "entityId",
          "toState",
          "notify"
        ],
        "additionalProperties": false
      },
      "DocPageSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "enum": [
              "general",
              "device",
              "room",
              "emergency",
              "rules",
              "howto"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "guestVisible": {
            "type": "boolean"
          },
          "pinned": {
            "type": "boolean"
          },
          "rev": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "excerpt": {
            "type": "string"
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "updatedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "slug",
          "title",
          "section",
          "assetId",
          "roomId",
          "sortOrder",
          "guestVisible",
          "pinned",
          "rev",
          "excerpt",
          "commentCount",
          "updatedBy",
          "updatedByName",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "DocPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "enum": [
              "general",
              "device",
              "room",
              "emergency",
              "rules",
              "howto"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "guestVisible": {
            "type": "boolean"
          },
          "pinned": {
            "type": "boolean"
          },
          "rev": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "excerpt": {
            "type": "string"
          },
          "commentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "updatedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "bodyMd": {
            "type": "string"
          },
          "renderedHtml": {
            "type": "string"
          },
          "headings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Heading"
            }
          },
          "backlinks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PageBacklink"
            }
          }
        },
        "required": [
          "id",
          "slug",
          "title",
          "section",
          "assetId",
          "roomId",
          "sortOrder",
          "guestVisible",
          "pinned",
          "rev",
          "excerpt",
          "commentCount",
          "updatedBy",
          "updatedByName",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "bodyMd",
          "renderedHtml",
          "headings",
          "backlinks"
        ],
        "additionalProperties": false
      },
      "Heading": {
        "type": "object",
        "properties": {
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "text": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "level",
          "text",
          "id"
        ],
        "additionalProperties": false
      },
      "PageBacklink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "title"
        ],
        "additionalProperties": false
      },
      "PageRevisionSummary": {
        "type": "object",
        "properties": {
          "rev": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "rev",
          "title",
          "size",
          "userId",
          "userName",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "PageRevision": {
        "type": "object",
        "properties": {
          "rev": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "bodyMd": {
            "type": "string"
          }
        },
        "required": [
          "rev",
          "title",
          "size",
          "userId",
          "userName",
          "createdAt",
          "bodyMd"
        ],
        "additionalProperties": false
      },
      "SearchHit": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "page",
              "asset",
              "room",
              "task",
              "defect",
              "contact",
              "part",
              "asset_hint",
              "insurance_policy",
              "appointment",
              "document"
            ]
          },
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "snippet": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "id",
          "title",
          "snippet",
          "url"
        ],
        "additionalProperties": false
      },
      "Attachment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "asset",
              "room",
              "page",
              "task",
              "defect",
              "service_log",
              "part",
              "asset_hint",
              "contact",
              "cost",
              "insurance_policy",
              "asset_note",
              "tire_set",
              "appointment",
              "ai_task"
            ]
          },
          "ownerId": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "width": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "height": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "caption": {
            "type": [
              "string",
              "null"
            ]
          },
          "guestVisible": {
            "type": "boolean"
          },
          "url": {
            "type": "string"
          },
          "thumbUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "uploadedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "ownerType",
          "ownerId",
          "filename",
          "mime",
          "size",
          "width",
          "height",
          "caption",
          "guestVisible",
          "url",
          "thumbUrl",
          "uploadedBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "NotificationSettings": {
        "type": "object",
        "properties": {
          "pushEnabled": {
            "type": "boolean"
          },
          "quietStart": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
              },
              {
                "type": "null"
              }
            ]
          },
          "quietEnd": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
              },
              {
                "type": "null"
              }
            ]
          },
          "pushStages": {
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "prep",
                "due_soon",
                "due",
                "overdue",
                "digest",
                "hint",
                "comment"
              ]
            }
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationTarget"
            }
          }
        },
        "required": [
          "pushEnabled",
          "quietStart",
          "quietEnd",
          "pushStages",
          "targets"
        ],
        "additionalProperties": false
      },
      "NotificationTarget": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "ha_notify"
            ]
          },
          "target": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-z0-9_]+$"
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "channel",
          "target",
          "enabled"
        ],
        "additionalProperties": false
      },
      "Integration": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "homeassistant",
              "paperless",
              "kept"
            ]
          },
          "level": {
            "type": "string",
            "enum": [
              "household",
              "user"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "configured": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "baseUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowInsecureTls": {
            "type": "boolean"
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error",
              "unknown"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastOkAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastCheckedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "consecutiveFailures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "kind",
          "level",
          "available",
          "capabilities",
          "configured",
          "enabled",
          "baseUrl",
          "allowInsecureTls",
          "config",
          "status",
          "lastError",
          "lastOkAt",
          "lastCheckedAt",
          "consecutiveFailures"
        ],
        "additionalProperties": false
      },
      "IntegrationTest": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "info": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "integration": {
            "$ref": "#/components/schemas/Integration"
          }
        },
        "required": [
          "ok",
          "error",
          "info",
          "integration"
        ],
        "additionalProperties": false
      },
      "ExternalEntity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "area": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "domain",
          "name",
          "state",
          "unit",
          "area"
        ],
        "additionalProperties": false
      },
      "ExternalCalendar": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "capabilities": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CalendarCapabilities"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "capabilities"
        ],
        "additionalProperties": false
      },
      "CalendarCapabilities": {
        "type": "object",
        "properties": {
          "create": {
            "type": "boolean"
          },
          "update": {
            "type": "boolean"
          },
          "delete": {
            "type": "boolean"
          },
          "alarms": {
            "type": "boolean"
          }
        },
        "required": [
          "create",
          "update",
          "delete",
          "alarms"
        ],
        "additionalProperties": false
      },
      "ExternalDevice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "manufacturer": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "area": {
            "type": [
              "string",
              "null"
            ]
          },
          "areaId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "manufacturer",
          "model",
          "area",
          "areaId"
        ],
        "additionalProperties": false
      },
      "ExternalArea": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string"
          },
          "floor": {
            "type": [
              "string",
              "null"
            ]
          },
          "roomId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "floor",
          "roomId"
        ],
        "additionalProperties": false
      },
      "ExternalTag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "color",
          "documentCount"
        ],
        "additionalProperties": false
      },
      "ExternalCorrespondent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "documentCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "documentCount"
        ],
        "additionalProperties": false
      },
      "ExternalCustomField": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "dataType": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "ExternalGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "ExternalStoragePath": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "path"
        ],
        "additionalProperties": false
      },
      "ExternalDocument": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "externalId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "createdDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "correspondentId": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "correspondentName": {
            "type": [
              "string",
              "null"
            ]
          },
          "tagIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "tagNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mimeType": {
            "type": [
              "string",
              "null"
            ]
          },
          "pageCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "noteCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "warrantyUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyExtendedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "linkedTo": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLinkSummary"
            }
          },
          "thumbUrl": {
            "type": "string"
          },
          "previewUrl": {
            "type": "string"
          },
          "downloadUrl": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "externalId",
          "title",
          "createdDate",
          "correspondentId",
          "correspondentName",
          "tagIds",
          "tagNames",
          "mimeType",
          "pageCount",
          "noteCount",
          "warrantyUntil",
          "warrantyExtendedUntil",
          "linkedTo",
          "thumbUrl",
          "previewUrl",
          "downloadUrl"
        ],
        "additionalProperties": false
      },
      "DocumentLinkSummary": {
        "type": "object",
        "properties": {
          "linkId": {
            "type": "string"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "asset",
              "room",
              "page",
              "task",
              "defect",
              "service_log",
              "part",
              "contact",
              "cost",
              "insurance_policy"
            ]
          },
          "ownerId": {
            "type": "string"
          },
          "ownerTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownerUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "manual",
              "receipt",
              "warranty",
              "datasheet",
              "correspondence",
              "invoice",
              "policy",
              "registration",
              "other"
            ]
          }
        },
        "required": [
          "linkId",
          "ownerType",
          "ownerId",
          "ownerTitle",
          "ownerUrl",
          "role"
        ],
        "additionalProperties": false
      },
      "AssetSuggestion": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "asset"
          },
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "externalId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "createdDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "correspondentName": {
            "type": [
              "string",
              "null"
            ]
          },
          "warrantyUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyExtendedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "kind",
          "provider",
          "externalId",
          "title",
          "createdDate",
          "correspondentName",
          "warrantyUntil",
          "warrantyExtendedUntil"
        ],
        "additionalProperties": false
      },
      "ContactSuggestion": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "contact"
          },
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "correspondentId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "documentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "externalSource": {
            "type": "string"
          },
          "externalRef": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "provider",
          "correspondentId",
          "name",
          "documentCount",
          "externalSource",
          "externalRef"
        ],
        "additionalProperties": false
      },
      "DocumentUpload": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "uploading",
              "processing",
              "done",
              "failed"
            ]
          },
          "attachmentId": {
            "type": "string"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "asset",
              "room",
              "page",
              "task",
              "defect",
              "service_log",
              "part",
              "contact",
              "cost",
              "insurance_policy"
            ]
          },
          "ownerId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "manual",
              "receipt",
              "warranty",
              "datasheet",
              "correspondence",
              "invoice",
              "policy",
              "registration",
              "other"
            ]
          },
          "title": {
            "type": "string"
          },
          "externalId": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "linkId": {
            "type": [
              "string",
              "null"
            ]
          },
          "duplicate": {
            "type": "boolean"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "warning": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "provider",
          "status",
          "attachmentId",
          "ownerType",
          "ownerId",
          "role",
          "title",
          "externalId",
          "linkId",
          "duplicate",
          "errorCode",
          "warning",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ExternalDocumentDetail": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "externalId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "createdDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "correspondentId": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "correspondentName": {
            "type": [
              "string",
              "null"
            ]
          },
          "tagIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "tagNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mimeType": {
            "type": [
              "string",
              "null"
            ]
          },
          "pageCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "noteCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "warrantyUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyExtendedUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "linkedTo": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLinkSummary"
            }
          },
          "thumbUrl": {
            "type": "string"
          },
          "previewUrl": {
            "type": "string"
          },
          "downloadUrl": {
            "type": "string"
          },
          "webUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLink"
            }
          }
        },
        "required": [
          "provider",
          "externalId",
          "title",
          "createdDate",
          "correspondentId",
          "correspondentName",
          "tagIds",
          "tagNames",
          "mimeType",
          "pageCount",
          "noteCount",
          "warrantyUntil",
          "warrantyExtendedUntil",
          "linkedTo",
          "thumbUrl",
          "previewUrl",
          "downloadUrl",
          "webUrl",
          "links"
        ],
        "additionalProperties": false
      },
      "DocumentLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "paperless"
            ]
          },
          "externalId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "asset",
              "room",
              "page",
              "task",
              "defect",
              "service_log",
              "part",
              "contact",
              "cost",
              "insurance_policy"
            ]
          },
          "ownerId": {
            "type": "string"
          },
          "ownerTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownerUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "manual",
              "receipt",
              "warranty",
              "datasheet",
              "correspondence",
              "invoice",
              "policy",
              "registration",
              "other"
            ]
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "document": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "createdDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "correspondentName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "mimeType": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pageCount": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tagNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "title",
                  "createdDate",
                  "correspondentName",
                  "mimeType",
                  "pageCount",
                  "tagNames"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "thumbUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "previewUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "downloadUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "provider",
          "externalId",
          "ownerType",
          "ownerId",
          "ownerTitle",
          "ownerUrl",
          "role",
          "label",
          "available",
          "document",
          "thumbUrl",
          "previewUrl",
          "downloadUrl",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "FinanceCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "expense",
              "income"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "parentId",
          "kind"
        ],
        "additionalProperties": false
      },
      "FinanceAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "currency",
          "type",
          "archived"
        ],
        "additionalProperties": false
      },
      "NotificationActionResult": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string"
          },
          "completionId": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "taskId",
          "completionId",
          "replayed"
        ],
        "additionalProperties": false
      },
      "CalendarFeed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "mine",
              "all"
            ]
          },
          "includeEstimated": {
            "type": "boolean"
          },
          "includePreparations": {
            "type": "boolean"
          },
          "includeDefects": {
            "type": "boolean"
          },
          "includeWarranties": {
            "type": "boolean"
          },
          "alarmTime": {
            "type": [
              "string",
              "null"
            ]
          },
          "alarmDaysBefore": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "locale": {
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastFetchedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "scope",
          "includeEstimated",
          "includePreparations",
          "includeDefects",
          "includeWarranties",
          "alarmTime",
          "alarmDaysBefore",
          "locale",
          "url",
          "lastFetchedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CalendarTarget": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "provider": {
            "type": "string",
            "enum": [
              "homeassistant"
            ]
          },
          "level": {
            "type": "string",
            "enum": [
              "household",
              "user"
            ]
          },
          "ownerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "remoteCalendarId": {
            "type": "string"
          },
          "remoteName": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "config": {
            "$ref": "#/components/schemas/CalendarTargetConfig"
          },
          "capabilities": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CalendarCapabilities"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error",
              "unknown"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastOkAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastCheckedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextAttemptAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "consecutiveFailures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastStats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CalendarSyncCounts"
              },
              {
                "type": "null"
              }
            ]
          },
          "eventCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "canManage": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "provider",
          "level",
          "ownerId",
          "remoteCalendarId",
          "remoteName",
          "name",
          "enabled",
          "config",
          "capabilities",
          "status",
          "lastError",
          "lastOkAt",
          "lastCheckedAt",
          "nextAttemptAt",
          "consecutiveFailures",
          "lastStats",
          "eventCount",
          "canManage",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CalendarTargetConfig": {
        "type": "object",
        "properties": {
          "kinds": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "appointments",
                "task_due",
                "preparations",
                "defect_deadlines",
                "insurance_deadlines",
                "warranty_ends"
              ]
            }
          },
          "direction": {
            "default": "push",
            "type": "string",
            "enum": [
              "push"
            ]
          },
          "scope": {
            "default": "all",
            "type": "string",
            "enum": [
              "mine",
              "all"
            ]
          },
          "timedMode": {
            "default": "all_day",
            "type": "string",
            "enum": [
              "all_day",
              "timed"
            ]
          },
          "dueTime": {
            "default": "08:00",
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "dueDurationMinutes": {
            "default": 30,
            "type": "integer",
            "minimum": 5,
            "maximum": 480
          },
          "alarmMinutes": {
            "default": null,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 40320
              },
              {
                "type": "null"
              }
            ]
          },
          "titlePrefix": {
            "default": "",
            "type": "string",
            "maxLength": 30
          },
          "onRemoteDelete": {
            "default": "recreate",
            "type": "string",
            "enum": [
              "recreate",
              "forget"
            ]
          },
          "conflictPolicy": {
            "default": "hauswart_wins",
            "type": "string",
            "enum": [
              "hauswart_wins"
            ]
          },
          "locale": {
            "default": "de",
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          }
        },
        "required": [
          "kinds",
          "direction",
          "scope",
          "timedMode",
          "dueTime",
          "dueDurationMinutes",
          "alarmMinutes",
          "titlePrefix",
          "onRemoteDelete",
          "conflictPolicy",
          "locale"
        ],
        "additionalProperties": false
      },
      "CalendarSyncCounts": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "updated": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "replaced": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "deleted": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "adopted": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "forgotten": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "skipped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "unconfirmed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "created",
          "updated",
          "replaced",
          "deleted",
          "adopted",
          "forgotten",
          "skipped",
          "failed",
          "unconfirmed",
          "remaining"
        ],
        "additionalProperties": false
      },
      "CalendarSync": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/CalendarSyncCounts"
          },
          "target": {
            "$ref": "#/components/schemas/CalendarTarget"
          }
        },
        "required": [
          "ok",
          "error",
          "counts",
          "target"
        ],
        "additionalProperties": false
      },
      "Emergency": {
        "type": "object",
        "properties": {
          "household": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": false
          },
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmergencyPage"
            }
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmergencyAsset"
            }
          },
          "insurance": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmergencyInsurance"
            }
          }
        },
        "required": [
          "household",
          "pages",
          "contacts",
          "assets",
          "insurance"
        ],
        "additionalProperties": false
      },
      "EmergencyPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "enum": [
              "general",
              "device",
              "room",
              "emergency",
              "rules",
              "howto"
            ]
          },
          "renderedHtml": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "slug",
          "title",
          "section",
          "renderedHtml",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "EmergencyAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "pinnedHints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmergencyHint"
            }
          }
        },
        "required": [
          "id",
          "name",
          "roomName",
          "pinnedHints"
        ],
        "additionalProperties": false
      },
      "EmergencyHint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "bodyMd": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "tip",
              "rule",
              "warning"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "bodyMd",
          "kind"
        ],
        "additionalProperties": false
      },
      "EmergencyInsurance": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "motor_liability",
              "motor_partial_casco",
              "motor_full_casco",
              "household",
              "personal_liability",
              "building",
              "legal",
              "travel",
              "health",
              "life",
              "other"
            ]
          },
          "insurerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "insurerPhone": {
            "type": [
              "string",
              "null"
            ]
          },
          "policyNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "assistancePhone": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "type",
          "insurerName",
          "insurerPhone",
          "policyNumber",
          "assistancePhone"
        ],
        "additionalProperties": false
      },
      "GuestLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "scheduled",
              "expired",
              "revoked"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasPin": {
            "type": "boolean"
          },
          "pinLocked": {
            "type": "boolean"
          },
          "includeSecrets": {
            "type": "boolean"
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "emergency",
                "rules",
                "contacts",
                "devices",
                "howto"
              ]
            }
          },
          "pageIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "locale": {
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          },
          "lastViewedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "viewCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "label",
          "status",
          "createdBy",
          "createdByName",
          "startsAt",
          "expiresAt",
          "revokedAt",
          "hasPin",
          "pinLocked",
          "includeSecrets",
          "sections",
          "pageIds",
          "locale",
          "lastViewedAt",
          "viewCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CreatedGuestLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "scheduled",
              "expired",
              "revoked"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasPin": {
            "type": "boolean"
          },
          "pinLocked": {
            "type": "boolean"
          },
          "includeSecrets": {
            "type": "boolean"
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "emergency",
                "rules",
                "contacts",
                "devices",
                "howto"
              ]
            }
          },
          "pageIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "locale": {
            "type": "string",
            "enum": [
              "de",
              "en"
            ]
          },
          "lastViewedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "viewCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "status",
          "createdBy",
          "createdByName",
          "startsAt",
          "expiresAt",
          "revokedAt",
          "hasPin",
          "pinLocked",
          "includeSecrets",
          "sections",
          "pageIds",
          "locale",
          "lastViewedAt",
          "viewCount",
          "createdAt",
          "updatedAt",
          "url"
        ],
        "additionalProperties": false
      },
      "AiTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "receipt",
              "fuel_receipt",
              "service_invoice",
              "insurance_policy"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "done",
              "dismissed"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Attachment"
              },
              {
                "type": "null"
              }
            ]
          },
          "bookId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bookName": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assetName": {
            "type": [
              "string",
              "null"
            ]
          },
          "claim": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AiTaskClaim"
              },
              {
                "type": "null"
              }
            ]
          },
          "bookedSoFar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiTaskCost"
            }
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AiTaskResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "dismissReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "completedVia": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "session",
                  "mobile",
                  "integration",
                  "ha",
                  "mcp"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "completedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "note",
          "createdByUserId",
          "createdByName",
          "attachment",
          "bookId",
          "bookName",
          "assetId",
          "assetName",
          "claim",
          "bookedSoFar",
          "result",
          "dismissReason",
          "completedAt",
          "completedVia",
          "completedByUserId",
          "completedByName",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "AiTaskClaim": {
        "type": "object",
        "properties": {
          "byUserId": {
            "type": "string"
          },
          "byName": {
            "type": [
              "string",
              "null"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "byUserId",
          "byName",
          "at",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "AiTaskCost": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "title": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string"
          },
          "reviewNeeded": {
            "type": "boolean"
          },
          "fuelLogId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "date",
          "title",
          "amountMinor",
          "currency",
          "reviewNeeded",
          "fuelLogId"
        ],
        "additionalProperties": false
      },
      "AiTaskResult": {
        "type": "object",
        "properties": {
          "createdCostIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdFuelLogIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "costs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiTaskCost"
            }
          }
        },
        "required": [
          "createdCostIds",
          "createdFuelLogIds",
          "note",
          "costs"
        ],
        "additionalProperties": false
      },
      "AiTaskCount": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "count"
        ],
        "additionalProperties": false
      }
    }
  }
}
