{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/besttimetobookhotels-com/json-schema/besttimetobookhotels-com-deal-history-series-schema.json",
  "title": "DealHistorySeries",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/besttimetobookhotels-com-openapi.json#/components/schemas/DealHistorySeries",
  "type": "object",
  "required": [
    "baselineUsd",
    "checkIn",
    "checkOut",
    "points",
    "snapshotDate",
    "snapshotDropPercent",
    "snapshotUsd"
  ],
  "properties": {
    "baselineUsd": {
      "type": "number",
      "description": "Typical observed nightly price for this stay, USD."
    },
    "checkIn": {
      "$ref": "#/$defs/IsoDate"
    },
    "checkOut": {
      "$ref": "#/$defs/IsoDate"
    },
    "snapshotDate": {
      "$ref": "#/$defs/IsoDate",
      "description": "Observation date the published deal was taken from."
    },
    "snapshotUsd": {
      "type": "number"
    },
    "snapshotDropPercent": {
      "type": "number",
      "description": "Percent below `baselineUsd` at `snapshotDate`."
    },
    "points": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DealHistoryPoint"
      }
    }
  },
  "$defs": {
    "DealHistoryPoint": {
      "type": "object",
      "required": [
        "daysBeforeCheckIn",
        "medianUsd",
        "scrapedDate",
        "window"
      ],
      "properties": {
        "daysBeforeCheckIn": {
          "type": "integer"
        },
        "medianUsd": {
          "type": "number"
        },
        "scrapedDate": {
          "$ref": "#/$defs/IsoDate"
        },
        "window": {
          "type": "string",
          "enum": [
            "baseline",
            "near",
            "outside"
          ],
          "description": "Which lead-time window the observation falls in."
        }
      }
    },
    "IsoDate": {
      "type": "string",
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    }
  }
}