{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.sabre.com/schemas/hotel",
  "title": "Sabre Hotel",
  "description": "A hotel property as returned from the Sabre Hotels API",
  "type": "object",
  "properties": {
    "hotelCode": {
      "type": "string",
      "description": "Sabre GDS property code"
    },
    "chainCode": {
      "type": "string",
      "description": "Hotel chain code (e.g., HH for Hilton, MC for Marriott)"
    },
    "name": {
      "type": "string",
      "description": "Hotel property name"
    },
    "starRating": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5,
      "description": "Normalized star rating"
    },
    "address": {
      "$ref": "#/$defs/Address"
    },
    "coordinates": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "required": ["latitude", "longitude"]
    },
    "amenities": {
      "type": "array",
      "description": "List of hotel amenity codes (OTA HAC list)",
      "items": {
        "type": "string"
      }
    },
    "images": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "category": {
            "type": "string",
            "enum": ["Exterior", "Lobby", "Room", "Pool", "Restaurant", "Other"]
          }
        },
        "required": ["url"]
      }
    },
    "lowestRate": {
      "$ref": "#/$defs/Rate"
    },
    "availableRooms": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RoomType"
      }
    }
  },
  "required": ["hotelCode", "name", "address"],
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "stateProvince": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        },
        "countryCode": {
          "type": "string",
          "pattern": "^[A-Z]{2}$",
          "description": "ISO 3166-1 alpha-2 country code"
        }
      },
      "required": ["city", "countryCode"]
    },
    "Rate": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "minimum": 0
        },
        "currencyCode": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "rateType": {
          "type": "string",
          "enum": ["PerNight", "Total"]
        }
      },
      "required": ["amount", "currencyCode"]
    },
    "RoomType": {
      "type": "object",
      "properties": {
        "roomTypeCode": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "maxOccupancy": {
          "type": "integer",
          "minimum": 1
        },
        "bedConfiguration": {
          "type": "string",
          "examples": ["King", "2 Queens", "Twin"]
        },
        "smokingAllowed": {
          "type": "boolean"
        },
        "ratePlans": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "ratePlanCode": {
                "type": "string"
              },
              "ratePlanName": {
                "type": "string"
              },
              "dailyRate": {
                "$ref": "#/$defs/Rate"
              },
              "totalRate": {
                "$ref": "#/$defs/Rate"
              },
              "refundable": {
                "type": "boolean"
              },
              "cancellationPolicy": {
                "type": "string"
              },
              "mealPlan": {
                "type": "string",
                "enum": ["RoomOnly", "BedAndBreakfast", "HalfBoard", "FullBoard", "AllInclusive"]
              }
            },
            "required": ["ratePlanCode", "dailyRate"]
          }
        }
      },
      "required": ["roomTypeCode", "name"]
    }
  }
}
