{
  "openapi": "3.1.0",
  "info": {
    "title": "Pioneertown Motel availability API",
    "version": "1.0.0",
    "description": "Read-only live nightly rates for the official Pioneertown Motel website. Prices are nightly room rates only; taxes and fees are added at booking. A room that is not quotable has no published rate for at least one requested night and may be sold out. To book, follow bookingUrl.",
    "contact": {
      "email": "info@pioneertown-motel.com",
      "name": "Pioneertown Motel"
    }
  },
  "servers": [
    {
      "url": "https://ptm.ltco.io"
    }
  ],
  "paths": {
    "/availability": {
      "get": {
        "summary": "Quote live nightly rates for a stay",
        "description": "Without checkin and checkout, returns a usage document with live dated example URLs (HTTP 200). start, end, and guest are accepted as aliases for checkin, checkout, and adults. The format query parameter outranks the Accept header.",
        "parameters": [
          {
            "name": "checkin",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "YYYY-MM-DD; today (America/Los_Angeles) or later, at most 365 days ahead."
          },
          {
            "name": "checkout",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "YYYY-MM-DD; after checkin, at most 14 nights after checkin."
          },
          {
            "name": "adults",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8,
              "default": 2
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "html",
                "md",
                "markdown",
                "json"
              ]
            },
            "description": "Response representation for clients that cannot set an Accept header."
          }
        ],
        "responses": {
          "200": {
            "description": "A quote (or, without dates, the usage document).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityPayload"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid dates or guest count; the body explains the problem and includes a live example URL."
          },
          "503": {
            "description": "Live rates are temporarily unavailable; the body includes the booking-page fallback URL."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AvailabilityPayload": {
        "type": "object",
        "properties": {
          "adults": {
            "type": "integer"
          },
          "bookingUrl": {
            "type": "string",
            "format": "uri",
            "description": "Booking page pre-filled with these dates and guest count. Needs JavaScript."
          },
          "checkin": {
            "type": "string",
            "format": "date"
          },
          "checkout": {
            "type": "string",
            "format": "date"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, e.g. USD."
          },
          "nights": {
            "type": "integer"
          },
          "note": {
            "type": "string"
          },
          "origin": {
            "type": "string",
            "format": "uri"
          },
          "petPolicy": {
            "type": "string"
          },
          "retrievedAt": {
            "type": "string",
            "format": "date-time"
          },
          "rooms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoomQuote"
            }
          },
          "taxesAndFeesIncluded": {
            "type": "boolean",
            "const": false
          }
        }
      },
      "RoomQuote": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "king",
              "queen",
              "twin",
              "redCabin"
            ]
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The room page on the official website."
          },
          "nightly": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "price": {
                  "type": "number"
                }
              }
            }
          },
          "totalForStay": {
            "type": [
              "number",
              "null"
            ]
          },
          "quotable": {
            "type": "boolean",
            "description": "False when at least one requested night has no published rate; the room may be sold out."
          }
        }
      }
    }
  }
}
