{
  "openapi": "3.1.0",
  "info": {
    "title": "Alpina.travel Agent Booking API",
    "version": "0.3.0",
    "description": "Live availability and provider-hosted checkout handoff for curated Alpina.travel stays. The current BookingNests browser adapter returns a live quote and booking-page URL, but cannot guarantee that dates and guests remain prefilled on the provider page. Availability is time-sensitive and must be revalidated before payment."
  },
  "servers": [
    {
      "url": "https://alpina.travel"
    }
  ],
  "paths": {
    "/api/booking/properties/samspitze-4": {
      "get": {
        "operationId": "getSamspitze4",
        "summary": "Get bookable property details",
        "responses": {
          "200": {
            "description": "Property details and booking capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/booking/availability": {
      "get": {
        "operationId": "checkSamspitze4AvailabilityWithQuery",
        "summary": "Check live availability and obtain a EUR quote using query parameters",
        "description": "Read-only compatibility endpoint for agents that can invoke GET but not POST. Repeat childrenAges for each child, for example childrenAges=8&childrenAges=11.",
        "parameters": [
          {
            "name": "propertyId",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "samspitze-4",
                "441179"
              ],
              "default": "samspitze-4"
            }
          },
          {
            "name": "checkIn",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "checkOut",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "adults",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 6
            }
          },
          {
            "name": "childrenAges",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 0,
                "maximum": 14
              },
              "maxItems": 5,
              "default": []
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "EUR"
              ],
              "default": "EUR"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live availability result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing dates, occupancy, or currency"
          },
          "502": {
            "description": "BookingNests could not be reached or parsed"
          }
        }
      },
      "post": {
        "operationId": "checkSamspitze4Availability",
        "summary": "Check live availability and obtain a EUR quote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Live availability result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid dates, occupancy, or currency"
          },
          "502": {
            "description": "BookingNests could not be reached or parsed"
          }
        }
      }
    },
    "/api/booking/sessions": {
      "post": {
        "operationId": "createSamspitze4BookingSession",
        "summary": "Create a provider-hosted checkout handoff",
        "description": "Rechecks availability and returns the BookingNests booking-page URL. The agent must obtain explicit user confirmation before invoking this action. The user may need to re-enter dates and guests on BookingNests. Payment details are entered only on the provider checkout.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Checkout handoff created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingSession"
                }
              }
            }
          },
          "409": {
            "description": "Property is no longer available"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AvailabilityInput": {
        "type": "object",
        "required": [
          "checkIn",
          "checkOut",
          "adults"
        ],
        "properties": {
          "propertyId": {
            "type": "string",
            "enum": [
              "samspitze-4",
              "441179"
            ],
            "default": "samspitze-4"
          },
          "checkIn": {
            "type": "string",
            "format": "date"
          },
          "checkOut": {
            "type": "string",
            "format": "date"
          },
          "adults": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "childrenAges": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 14
            },
            "maxItems": 5,
            "default": []
          },
          "currency": {
            "type": "string",
            "enum": [
              "EUR"
            ],
            "default": "EUR"
          },
          "locale": {
            "type": "string",
            "default": "en"
          }
        }
      },
      "AvailabilityResult": {
        "type": "object",
        "required": [
          "propertyId",
          "status",
          "available",
          "checkoutUrl",
          "checkedAt",
          "expiresAt",
          "requiresRevalidation"
        ],
        "properties": {
          "propertyId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "quote": {
            "type": "object",
            "properties": {
              "total": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string",
                    "const": "EUR"
                  }
                }
              },
              "breakdown": {
                "type": "object",
                "properties": {
                  "instantConfirmation": {
                    "type": "boolean"
                  },
                  "cancellationPolicy": {
                    "type": "object"
                  },
                  "taxes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "stayNotes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "checkoutPrefillGuaranteed": {
                    "type": "boolean",
                    "const": false
                  }
                }
              }
            }
          },
          "checkoutUrl": {
            "type": "string",
            "format": "uri"
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "requiresRevalidation": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "BookingSession": {
        "type": "object",
        "required": [
          "sessionId",
          "status",
          "checkoutUrl",
          "expiresAt",
          "paymentHandling",
          "checkoutPrefillGuaranteed"
        ],
        "properties": {
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "const": "requires_user_checkout"
          },
          "checkoutUrl": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "paymentHandling": {
            "type": "string",
            "const": "provider_checkout_only"
          },
          "checkoutPrefillGuaranteed": {
            "type": "boolean",
            "const": false
          }
        }
      }
    }
  }
}