{
    "openapi": "3.0.3",
    "info": {
        "title": "RMS API · web-wiiser",
        "version": "1.0",
        "description": "REST-API von RMS. Schlüssel im web-wiiser-Kundenbereich unter Software. Webhooks: Ereignisse rms.<objekt>.created|updated|deleted, Signatur X-WW-Signature: t=<unix>,v1=HMAC-SHA256(geheimnis, \"<t>.<körper>\")."
    },
    "servers": [
        {
            "url": "https://rms.saas.web-wiiser.ch"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "ressource": {
                "type": "object",
                "title": "Ressource",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "name": {
                        "type": "string",
                        "title": "Name"
                    },
                    "typ": {
                        "type": "string",
                        "enum": [
                            "Person",
                            "Raum",
                            "Fahrzeug",
                            "Gerät"
                        ],
                        "title": "Typ"
                    },
                    "kapazitaet": {
                        "type": "integer",
                        "title": "Kapazität"
                    },
                    "standort": {
                        "type": "string",
                        "title": "Standort"
                    },
                    "kosten_h": {
                        "type": "number",
                        "title": "Kosten pro Stunde"
                    },
                    "farbe": {
                        "type": "string",
                        "title": "Farbe"
                    },
                    "aktiv": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ],
                        "title": "Aktiv"
                    },
                    "notiz": {
                        "type": "string",
                        "title": "Notiz"
                    },
                    "created_at": {
                        "type": "string",
                        "readOnly": true
                    },
                    "updated_at": {
                        "type": "string",
                        "readOnly": true
                    }
                },
                "required": [
                    "name",
                    "typ"
                ]
            },
            "buchung": {
                "type": "object",
                "title": "Buchung",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titel": {
                        "type": "string",
                        "title": "Titel"
                    },
                    "ressource": {
                        "type": "integer",
                        "description": "ID: ressource",
                        "title": "Ressource"
                    },
                    "start": {
                        "type": "string",
                        "example": "2026-01-31 14:00",
                        "title": "Beginn"
                    },
                    "ende": {
                        "type": "string",
                        "example": "2026-01-31 14:00",
                        "title": "Ende"
                    },
                    "gebucht_fuer": {
                        "type": "string",
                        "title": "Für (Projekt/Kunde)"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "Geplant",
                            "Bestätigt",
                            "Abgesagt"
                        ],
                        "title": "Status"
                    },
                    "notiz": {
                        "type": "string",
                        "title": "Notiz"
                    },
                    "created_at": {
                        "type": "string",
                        "readOnly": true
                    },
                    "updated_at": {
                        "type": "string",
                        "readOnly": true
                    }
                },
                "required": [
                    "titel",
                    "ressource",
                    "start",
                    "ende"
                ]
            }
        }
    },
    "paths": {
        "/api.php?r=ressource": {
            "get": {
                "summary": "Ressourcen auflisten",
                "operationId": "list_ressource",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Volltextsuche"
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Nur seit diesem Zeitpunkt geänderte (ISO 8601)"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 1000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "count": {
                                            "type": "integer"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ressource"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Ressource anlegen",
                "operationId": "create_ressource",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ressource"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Angelegt",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ressource"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Ungültige Angaben"
                    }
                }
            }
        },
        "/api.php?r=ressource/{id}": {
            "get": {
                "summary": "Ressource lesen",
                "operationId": "get_ressource",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ressource"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    }
                }
            },
            "patch": {
                "summary": "Ressource ändern (nur übergebene Felder)",
                "operationId": "update_ressource",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ressource"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ressource"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Ressource löschen",
                "operationId": "delete_ressource",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Gelöscht"
                    }
                }
            }
        },
        "/api.php?r=buchung": {
            "get": {
                "summary": "Buchungen auflisten",
                "operationId": "list_buchung",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Volltextsuche"
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Nur seit diesem Zeitpunkt geänderte (ISO 8601)"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 1000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "count": {
                                            "type": "integer"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/buchung"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Buchung anlegen",
                "operationId": "create_buchung",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/buchung"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Angelegt",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/buchung"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Ungültige Angaben"
                    }
                }
            }
        },
        "/api.php?r=buchung/{id}": {
            "get": {
                "summary": "Buchung lesen",
                "operationId": "get_buchung",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/buchung"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Nicht gefunden"
                    }
                }
            },
            "patch": {
                "summary": "Buchung ändern (nur übergebene Felder)",
                "operationId": "update_buchung",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/buchung"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/buchung"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Buchung löschen",
                "operationId": "delete_buchung",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Gelöscht"
                    }
                }
            }
        }
    }
}