{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/quub-rent/json-schema/quub-rent-booking-schema.json",
  "title": "Booking",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/quub-rent-openapi.json#/components/schemas/Booking",
  "type": "object",
  "properties": {
    "booking_id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "awaiting_payment",
        "confirming",
        "confirmed",
        "outcome_pending",
        "failed",
        "cancelled",
        "expired"
      ],
      "description": "The original status word, kept for older clients."
    },
    "state": {
      "type": "string",
      "enum": [
        "held",
        "awaiting_payment",
        "paid",
        "confirmed",
        "cancelled",
        "expired",
        "failed"
      ],
      "description": "The state to explain to the guest."
    },
    "state_explained": {
      "type": "string"
    },
    "hotel": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "address": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "checkin": {
      "type": "string",
      "format": "date"
    },
    "checkout": {
      "type": "string",
      "format": "date"
    },
    "adults": {
      "type": "integer"
    },
    "room": {
      "type": "string"
    },
    "board": {
      "type": "string"
    },
    "total": {
      "type": "number",
      "description": "A decimal amount in currency, two decimals at most."
    },
    "currency": {
      "type": "string"
    },
    "taxes_at_property": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tax"
      }
    },
    "refundable": {
      "type": "boolean"
    },
    "free_cancellation_until": {
      "type": [
        "string",
        "null"
      ]
    },
    "cancellation_terms": {
      "type": "string"
    },
    "guest": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string"
        },
        "last_name": {
          "type": "string"
        }
      }
    },
    "guest_details": {
      "type": "string",
      "enum": [
        "complete",
        "entered_by_guest_on_pay_page"
      ]
    },
    "pay_url": {
      "type": "string",
      "description": "Only while the hold is payable."
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "When an unpaid hold is released."
    },
    "confirmation_number": {
      "type": "string"
    },
    "hotel_reference": {
      "type": "string"
    },
    "voucher_url": {
      "type": "string"
    },
    "refund_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "cancellation_fee": {
      "type": [
        "number",
        "null"
      ]
    },
    "hold_released": {
      "type": "boolean"
    },
    "priced_for": {
      "type": "string",
      "enum": [
        "public",
        "agent key"
      ]
    },
    "booking_url": {
      "type": "string"
    },
    "created": {
      "type": "string",
      "format": "date-time"
    },
    "updated": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Tax": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "description": "A decimal amount in currency, two decimals at most."
        },
        "currency": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}