{
  "openapi": "3.1.0",
  "info": {
    "title": "Veruno Rental — ubytování (authra.cz)",
    "description": "Veřejné API pro AI agenty k rezervaci ubytování Authra (apartmány, pokoje, chata; Veruno Rental). Najdi jednotky (listAvailableUnits), spočítej cenu (getQuote), rezervuj (createBooking) → payment_url pro člověka. Agent neplatí. Bez auth.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://veruno.cz/api/v1/authra/rental",
      "description": "Authra (ubytování, demo)"
    }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "listAvailableUnits",
        "summary": "Volné jednotky (apartmány/pokoje) v termínu",
        "description": "Vrátí ubytovací jednotky s cenou a polem 'available' (počet VOLNÝCH v termínu; 0 = obsazeno). První krok při hledání ubytování na konkrétní noci.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Datum příjezdu YYYY-MM-DD",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-10-06"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Datum odjezdu YYYY-MM-DD (po from)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-10-09"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Katalog jednotek s dostupností",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "item_id jednotky — použij při quote a book"
                          },
                          "name": {
                            "type": "string"
                          },
                          "available": {
                            "type": "integer",
                            "description": "počet VOLNÝCH v termínu (0 = obsazeno)"
                          },
                          "min_nights": {
                            "type": "integer",
                            "description": "minimální počet nocí"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/quote": {
      "post": {
        "operationId": "getQuote",
        "summary": "Cena a dostupnost pobytu (bez zápisu)",
        "description": "Spočítá cenu za pobyt a ověří dostupnost. Nic nevytváří.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items",
                  "from",
                  "to"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "item_id",
                        "quantity"
                      ],
                      "properties": {
                        "item_id": {
                          "type": "integer"
                        },
                        "quantity": {
                          "type": "integer",
                          "default": 1
                        }
                      }
                    }
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-06"
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-09"
                  },
                  "coupon": {
                    "type": "string",
                    "description": "volitelný slevový kód"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rozpis ceny + dostupnost",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string"
                    },
                    "days": {
                      "type": "integer",
                      "description": "počet nocí"
                    },
                    "total": {
                      "type": "number"
                    },
                    "deposit": {
                      "type": "number"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/book-public": {
      "post": {
        "operationId": "createBooking",
        "summary": "Vytvoření rezervace ubytování (vrátí payment_url)",
        "description": "Vytvoří rezervaci ubytování ve stavu pending a vrátí payment_url. Agent neplatí — payment_url předej uživateli. Předtím potvrď jednotku, termín, počet osob a cenu (getQuote) a vyžádej jméno a e-mail nebo telefon. consent_terms i consent_gdpr musí být true.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items",
                  "from",
                  "to",
                  "consent_terms",
                  "consent_gdpr"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "item_id",
                        "quantity"
                      ],
                      "properties": {
                        "item_id": {
                          "type": "integer"
                        },
                        "quantity": {
                          "type": "integer",
                          "default": 1
                        }
                      }
                    }
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-06"
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-09"
                  },
                  "adults": {
                    "type": "integer",
                    "description": "počet dospělých",
                    "example": 2
                  },
                  "children": {
                    "type": "integer",
                    "description": "počet dětí",
                    "example": 0
                  },
                  "child_ages": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "věk dětí (0-17)"
                  },
                  "customer_first": {
                    "type": "string"
                  },
                  "customer_last": {
                    "type": "string"
                  },
                  "customer_email": {
                    "type": "string",
                    "format": "email",
                    "description": "e-mail NEBO telefon je povinný"
                  },
                  "customer_phone": {
                    "type": "string"
                  },
                  "coupon": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "consent_terms": {
                    "type": "boolean",
                    "description": "souhlas s podmínkami (true)"
                  },
                  "consent_gdpr": {
                    "type": "boolean",
                    "description": "souhlas GDPR (true)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Rezervace vytvořena",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "booking_code": {
                      "type": "string"
                    },
                    "access_token": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "pending"
                    },
                    "total_price": {
                      "type": "string"
                    },
                    "deposit_amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "payment_url": {
                      "type": "string",
                      "description": "odkaz na platbu — PŘEDEJ UŽIVATELI, agent neplatí"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Chyba vstupu (consent_required, contact_required, empty_cart, invalid_dates, min_nights)"
          },
          "429": {
            "description": "Rate limit"
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/bookings/{code}": {
      "get": {
        "operationId": "getBookingStatus",
        "summary": "Stav rezervace",
        "description": "Stav rezervace podle kódu; vyžaduje access_token jako parametr t.",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "t",
            "in": "query",
            "required": true,
            "description": "access_token z createBooking",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detail rezervace"
          }
        }
      }
    }
  }
}