{
  "openapi": "3.1.0",
  "info": {
    "title": "Veruno Rental — agentní API (aurent.cz)",
    "description": "Veřejné API pro AI agenty k rezervaci vozů autopůjčovny Aurent (Veruno Rental). Najdi vozy (listAvailableCars), 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/aurent/rental",
      "description": "Aurent (autopůjčovna, demo)"
    }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "listAvailableCars",
        "summary": "Seznam vozů a jejich dostupnost v termínu",
        "description": "Vrátí vozy autopůjčovny s cenou a polem 'available' (počet VOLNÝCH kusů v termínu; 0 = obsazeno). Použij jako první krok, když uživatel hledá auto na konkrétní dny.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Datum vyzvednutí YYYY-MM-DD",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-10-06"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Datum vrácení YYYY-MM-DD (musí být po from)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-10-09"
            }
          },
          {
            "name": "loc",
            "in": "query",
            "required": false,
            "description": "Volitelně ID pobočky",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Katalog vozů s dostupností",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "item_id vozu — použij při quote a book"
                          },
                          "name": {
                            "type": "string"
                          },
                          "available": {
                            "type": "integer",
                            "description": "kolik kusů je v termínu VOLNÝCH (0 = obsazeno)"
                          },
                          "stock_units": {
                            "type": "integer",
                            "description": "celkový počet kusů"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/quote": {
      "post": {
        "operationId": "getQuote",
        "summary": "Výpočet ceny a dostupnosti (bez vytvoření rezervace)",
        "description": "Spočítá cenu a ověří dostupnost pro zvolené vozy a termín. Nic nevytváří. Použij k potvrzení ceny uživateli před rezervací.",
        "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"
                    },
                    "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 (vrátí payment_url pro platbu člověkem)",
        "description": "Vytvoří rezervaci vozu ve stavu pending a vrátí payment_url. Agent neplatí — payment_url předej uživateli. Předtím potvrď vůz, termín 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"
                  },
                  "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 obchodními podmínkami (musí být true)"
                  },
                  "consent_gdpr": {
                    "type": "boolean",
                    "description": "souhlas se zpracováním osobních údajů (musí být true)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Rezervace vytvořena",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "booking_code": {
                      "type": "string",
                      "description": "kód rezervace pro dohledání stavu"
                    },
                    "access_token": {
                      "type": "string",
                      "description": "token pro čtení stavu rezervace"
                    },
                    "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, booking_failed)"
          },
          "429": {
            "description": "Příliš mnoho pokusů (rate limit)"
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/bookings/{code}": {
      "get": {
        "operationId": "getBookingStatus",
        "summary": "Stav rezervace",
        "description": "Vrátí stav rezervace podle kódu. Vyžaduje access_token z createBooking jako parametr t.",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "booking_code z createBooking",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "t",
            "in": "query",
            "required": true,
            "description": "access_token z createBooking",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detail rezervace (stav, ceny, termín)"
          }
        }
      }
    }
  }
}