{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alert-camp/json-schema/alert-camp-cancellation-stats-response-schema.json",
  "title": "CancellationStatsResponse",
  "description": "Full cancellation statistics response.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alert-camp-stats-api-openapi.yml#/components/schemas/CancellationStatsResponse",
  "properties": {
    "overview": {
      "$ref": "#/$defs/CancellationOverview"
    },
    "by_park": {
      "items": {
        "$ref": "#/$defs/ParkCancellationStats"
      },
      "type": "array",
      "title": "By Park"
    },
    "by_day_of_week": {
      "items": {
        "$ref": "#/$defs/DayOfWeekStats"
      },
      "type": "array",
      "title": "By Day Of Week"
    },
    "by_hour_of_day": {
      "items": {
        "$ref": "#/$defs/HourOfDayStats"
      },
      "type": "array",
      "title": "By Hour Of Day"
    },
    "lead_time_distribution": {
      "items": {
        "$ref": "#/$defs/LeadTimeBucket"
      },
      "type": "array",
      "title": "Lead Time Distribution"
    },
    "by_detection_month": {
      "items": {
        "$ref": "#/$defs/MonthStats"
      },
      "type": "array",
      "title": "By Detection Month"
    },
    "by_camping_month": {
      "items": {
        "$ref": "#/$defs/MonthStats"
      },
      "type": "array",
      "title": "By Camping Month"
    },
    "rebooking_speed_by_park": {
      "items": {
        "$ref": "#/$defs/ParkRebookingSpeed"
      },
      "type": "array",
      "title": "Rebooking Speed By Park"
    },
    "alert_success_rate": {
      "$ref": "#/$defs/AlertSuccessRate"
    }
  },
  "type": "object",
  "required": [
    "overview",
    "by_park",
    "by_day_of_week",
    "by_hour_of_day",
    "lead_time_distribution",
    "by_detection_month",
    "by_camping_month",
    "rebooking_speed_by_park",
    "alert_success_rate"
  ],
  "$defs": {
    "AlertSuccessRate": {
      "properties": {
        "total_alerts": {
          "type": "integer",
          "title": "Total Alerts"
        },
        "alerts_with_matches": {
          "type": "integer",
          "title": "Alerts With Matches"
        },
        "success_rate": {
          "type": "number",
          "title": "Success Rate"
        }
      },
      "type": "object",
      "required": [
        "total_alerts",
        "alerts_with_matches",
        "success_rate"
      ],
      "title": "AlertSuccessRate",
      "description": "Alert success rate over a period."
    },
    "CancellationOverview": {
      "properties": {
        "total_cancellations": {
          "type": "integer",
          "title": "Total Cancellations"
        },
        "total_rebooked": {
          "type": "integer",
          "title": "Total Rebooked"
        },
        "rebooking_rate": {
          "type": "number",
          "title": "Rebooking Rate"
        },
        "avg_nights": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Nights"
        },
        "avg_rebooking_delay_minutes": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Rebooking Delay Minutes"
        },
        "median_rebooking_delay_minutes": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Median Rebooking Delay Minutes"
        },
        "avg_days_until": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Days Until"
        },
        "period_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Period Start"
        },
        "period_end": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Period End"
        }
      },
      "type": "object",
      "required": [
        "total_cancellations",
        "total_rebooked",
        "rebooking_rate",
        "avg_nights",
        "avg_rebooking_delay_minutes",
        "median_rebooking_delay_minutes",
        "avg_days_until",
        "period_start",
        "period_end"
      ],
      "title": "CancellationOverview",
      "description": "Aggregate overview of cancellation events."
    },
    "DayOfWeekStats": {
      "properties": {
        "day_of_week": {
          "type": "integer",
          "title": "Day Of Week"
        },
        "cancellation_count": {
          "type": "integer",
          "title": "Cancellation Count"
        }
      },
      "type": "object",
      "required": [
        "day_of_week",
        "cancellation_count"
      ],
      "title": "DayOfWeekStats",
      "description": "Cancellation counts by day of the week."
    },
    "HourOfDayStats": {
      "properties": {
        "hour": {
          "type": "integer",
          "title": "Hour"
        },
        "cancellation_count": {
          "type": "integer",
          "title": "Cancellation Count"
        }
      },
      "type": "object",
      "required": [
        "hour",
        "cancellation_count"
      ],
      "title": "HourOfDayStats",
      "description": "Cancellation counts by hour of the day (Eastern time)."
    },
    "LeadTimeBucket": {
      "properties": {
        "bucket": {
          "type": "string",
          "title": "Bucket"
        },
        "count": {
          "type": "integer",
          "title": "Count"
        }
      },
      "type": "object",
      "required": [
        "bucket",
        "count"
      ],
      "title": "LeadTimeBucket",
      "description": "Lead time distribution bucket."
    },
    "MonthStats": {
      "properties": {
        "month": {
          "type": "integer",
          "title": "Month"
        },
        "cancellation_count": {
          "type": "integer",
          "title": "Cancellation Count"
        }
      },
      "type": "object",
      "required": [
        "month",
        "cancellation_count"
      ],
      "title": "MonthStats",
      "description": "Cancellation counts by month (1=January ... 12=December)."
    },
    "ParkCancellationStats": {
      "properties": {
        "park_id": {
          "type": "string",
          "title": "Park Id"
        },
        "park_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Park Name"
        },
        "cancellation_count": {
          "type": "integer",
          "title": "Cancellation Count"
        }
      },
      "type": "object",
      "required": [
        "park_id",
        "park_name",
        "cancellation_count"
      ],
      "title": "ParkCancellationStats",
      "description": "Per-park cancellation counts."
    },
    "ParkRebookingSpeed": {
      "properties": {
        "park_id": {
          "type": "string",
          "title": "Park Id"
        },
        "park_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Park Name"
        },
        "avg_rebooking_delay_minutes": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avg Rebooking Delay Minutes"
        },
        "median_rebooking_delay_minutes": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Median Rebooking Delay Minutes"
        },
        "sample_size": {
          "type": "integer",
          "title": "Sample Size"
        }
      },
      "type": "object",
      "required": [
        "park_id",
        "park_name",
        "avg_rebooking_delay_minutes",
        "median_rebooking_delay_minutes",
        "sample_size"
      ],
      "title": "ParkRebookingSpeed",
      "description": "Rebooking speed metrics per park."
    }
  }
}