{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uklsp.org/schemas/v0.1/availability-slot.schema.json",
  "title": "AvailabilitySlot",
  "description": "A bookable window. Slots are server-authoritative: agents propose, the booking endpoint confirms.",
  "type": "object",
  "properties": {
    "slot_id": {
      "type": "string",
      "pattern": "^slt_[a-z0-9]{8,}$"
    },
    "provider_id": {
      "type": "string"
    },
    "service_code": {
      "type": "string"
    },
    "window_start": {
      "type": "string",
      "format": "date-time"
    },
    "window_end": {
      "type": "string",
      "format": "date-time"
    },
    "window_type": {
      "type": "string",
      "enum": [
        "exact",
        "am",
        "pm",
        "all_day"
      ]
    },
    "postcode_districts": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Z]{1,2}[0-9][A-Z0-9]?$",
        "description": "UK postcode district, e.g. LS6, M14, B1."
      }
    },
    "hold_expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Present only on a held slot returned to an agent mid-booking."
    }
  },
  "required": [
    "slot_id",
    "provider_id",
    "service_code",
    "window_start",
    "window_end",
    "window_type"
  ],
  "additionalProperties": false
}
