{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openteesheet.com/schemas/booking.schema.json",
  "title": "OpenTeeSheet booking (open format v1)",
  "description": "One booking of one bay for one time window. The door code itself is not part of the format: credentials are door grants (door-grant.schema.json) and their secrets never leave OpenTeeSheet.",
  "type": "object",
  "properties": {
    "object": {
      "const": "booking"
    },
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "venue_id": {
      "type": "string",
      "format": "uuid"
    },
    "bay_id": {
      "type": "string",
      "format": "uuid"
    },
    "start_time": {
      "type": "string",
      "format": "date-time"
    },
    "end_time": {
      "type": "string",
      "format": "date-time"
    },
    "duration_minutes": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "players": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "customer_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "customer_email": {
      "type": [
        "string",
        "null"
      ]
    },
    "customer_phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "minLength": 1,
      "description": "confirmed, pending_payment, checked_in, completed, cancelled, no_show, ..."
    },
    "payment_status": {
      "type": [
        "string",
        "null"
      ],
      "description": "unpaid, paid, refunded, ..."
    },
    "amount_cents": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "extra_players": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "guest_fee_cents": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "required": [
    "object",
    "id",
    "venue_id",
    "bay_id",
    "start_time",
    "end_time",
    "status"
  ],
  "additionalProperties": false
}
