{
  "components": {
    "schemas": {
      "Error": {
        "properties": {
          "detail": {
            "additionalProperties": true,
            "type": "object"
          },
          "error": {
            "description": "Stable machine-readable code",
            "enum": [
              "invalid_dates",
              "check_in_in_past",
              "below_minimum_stay",
              "above_maximum_stay",
              "outside_booking_window",
              "dates_unavailable",
              "invalid_guests",
              "terms_not_accepted",
              "invalid_contact",
              "booking_source_unavailable",
              "rate_limited",
              "invalid_json",
              "internal_error"
            ],
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "InquiryRequest": {
        "properties": {
          "bed_linen_and_towels": {
            "default": true,
            "type": "boolean"
          },
          "check_in": {
            "example": "2027-02-20",
            "format": "date",
            "type": "string"
          },
          "check_out": {
            "example": "2027-02-20",
            "format": "date",
            "type": "string"
          },
          "email": {
            "format": "email",
            "type": "string"
          },
          "guests": {
            "default": 2,
            "maximum": 6,
            "minimum": 1,
            "type": "integer"
          },
          "locale": {
            "description": "Language for the guest confirmation email.",
            "enum": [
              "en",
              "fi",
              "de",
              "fr",
              "nl"
            ],
            "type": "string"
          },
          "marketing_consent": {
            "default": false,
            "type": "boolean"
          },
          "message": {
            "description": "Arrival time, children's ages, special wishes.",
            "maxLength": 4000,
            "type": "string"
          },
          "name": {
            "maxLength": 120,
            "minLength": 2,
            "type": "string"
          },
          "phone": {
            "maxLength": 40,
            "type": "string"
          },
          "source": {
            "description": "Name of the agent or app submitting on the guest's behalf.",
            "example": "Claude",
            "type": "string"
          },
          "terms_accepted": {
            "description": "Must be true. The guest has read https://experiencelevi.fi/en/terms/",
            "type": "boolean"
          }
        },
        "required": [
          "check_in",
          "check_out",
          "name",
          "email",
          "terms_accepted"
        ],
        "type": "object"
      },
      "Quote": {
        "properties": {
          "accommodation_total_eur": {
            "type": "number"
          },
          "average_per_night_eur": {
            "type": "number"
          },
          "bed_linen_and_towels_included": {
            "type": "boolean"
          },
          "bed_linen_and_towels_total_eur": {
            "type": "number"
          },
          "check_in": {
            "example": "2027-02-20",
            "format": "date",
            "type": "string"
          },
          "check_out": {
            "example": "2027-02-20",
            "format": "date",
            "type": "string"
          },
          "cleaning_fee_eur": {
            "type": "number"
          },
          "currency": {
            "example": "EUR",
            "type": "string"
          },
          "guests": {
            "type": "integer"
          },
          "nightly_breakdown": {
            "items": {
              "properties": {
                "date": {
                  "example": "2027-02-20",
                  "format": "date",
                  "type": "string"
                },
                "price_eur": {
                  "type": "number"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "nights": {
            "type": "integer"
          },
          "total_eur": {
            "type": "number"
          }
        },
        "type": "object"
      }
    }
  },
  "info": {
    "contact": {
      "email": "info@levifinland.fi",
      "name": "Chalet Nulkka owners",
      "url": "https://experiencelevi.fi"
    },
    "description": "Read endpoints are public and CORS-open. Booking is by request: POST /api/v1/inquiries records a pending booking that the owner confirms by email, usually within 24 hours. No payment is taken through this API. Prices and availability come live from the owners' booking system.",
    "summary": "Availability, prices and booking requests for Chalet Nulkka, a holiday cabin in Levi, Finnish Lapland.",
    "termsOfService": "https://experiencelevi.fi/en/terms/",
    "title": "Chalet Nulkka booking API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/availability": {
      "get": {
        "operationId": "getAvailability",
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "schema": {
              "example": "2027-02-20",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Exclusive end date. Max range 400 days.",
            "in": "query",
            "name": "to",
            "schema": {
              "example": "2027-02-20",
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "nights": {
                      "items": {
                        "properties": {
                          "date": {
                            "example": "2027-02-20",
                            "format": "date",
                            "type": "string"
                          },
                          "price_eur": {
                            "type": "number"
                          },
                          "season": {
                            "type": "string"
                          },
                          "status": {
                            "enum": [
                              "available",
                              "booked",
                              "blocked",
                              "past",
                              "outside_booking_window"
                            ],
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "rules": {
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Nights"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Bad dates"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Booking system unreachable"
          }
        },
        "summary": "Per-night availability and price for a date range (default: today to end of booking window)."
      }
    },
    "/api/v1/inquiries": {
      "post": {
        "operationId": "createInquiry",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InquiryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "booking_id": {
                      "type": "integer"
                    },
                    "inquiry_id": {
                      "type": "integer"
                    },
                    "next_steps": {
                      "type": "string"
                    },
                    "quote": {
                      "$ref": "#/components/schemas/Quote"
                    },
                    "reference": {
                      "example": "CN-123",
                      "type": "string"
                    },
                    "status": {
                      "example": "pending",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Recorded"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Malformed body"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Dates unavailable"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Validation failed (terms_not_accepted, invalid_contact, rule violation)"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Rate limited"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Booking system unreachable"
          }
        },
        "summary": "Send a booking request. Records a pending booking and notifies the owner; the guest receives a confirmation email. Rate limited per IP."
      }
    },
    "/api/v1/pricing": {
      "get": {
        "operationId": "getPricing",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Pricing document"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Booking system unreachable"
          }
        },
        "summary": "Seasons with nightly prices, fees, and stay rules (live)."
      }
    },
    "/api/v1/property": {
      "get": {
        "operationId": "getProperty",
        "parameters": [
          {
            "description": "Language of the human-readable strings.",
            "in": "query",
            "name": "lang",
            "schema": {
              "enum": [
                "en",
                "fi",
                "de",
                "fr",
                "nl"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Property document"
          }
        },
        "summary": "Full property description: rooms, capacity, amenities, distances, rules, contact, images, pricing summary and how booking works."
      }
    },
    "/api/v1/quote": {
      "get": {
        "operationId": "getQuote",
        "parameters": [
          {
            "in": "query",
            "name": "check_in",
            "required": true,
            "schema": {
              "example": "2027-02-20",
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "check_out",
            "required": true,
            "schema": {
              "example": "2027-02-20",
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "guests",
            "schema": {
              "default": 2,
              "maximum": 6,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Include bed linen and towels (priced per guest).",
            "in": "query",
            "name": "linen",
            "schema": {
              "default": true,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "is_estimate": {
                      "type": "boolean"
                    },
                    "note": {
                      "type": "string"
                    },
                    "quote": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Quote"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Malformed parameters"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Dates unavailable"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Rule violation (min stay, window, guests)"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Booking system unreachable"
          }
        },
        "summary": "Price estimate for a stay. Validates minimum/maximum stay, booking window, guests and availability."
      }
    }
  },
  "servers": [
    {
      "url": "https://experiencelevi.fi"
    }
  ]
}
