{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentbookable-com/json-schema/agentbookable-com-booking-draft-schema.json",
  "title": "BookingDraft",
  "description": "The proposal to show the user. Consequential fields are immutable; consent binds to this exact content (draftHash).",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentbookable-com-openapi.json#/components/schemas/BookingDraft",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "businessId": {
      "type": "string"
    },
    "serviceId": {
      "type": "string"
    },
    "serviceName": {
      "type": "string"
    },
    "start": {
      "type": "string"
    },
    "end": {
      "type": "string"
    },
    "durationMinutes": {
      "type": "integer"
    },
    "timezone": {
      "type": "string"
    },
    "staffId": {
      "type": [
        "string",
        "null"
      ]
    },
    "customer": {
      "$ref": "#/$defs/customer"
    },
    "requirements": {
      "$ref": "#/$defs/BookingRequirements"
    },
    "expiresAt": {
      "type": "string",
      "description": "Drafts expire after 30 minutes"
    }
  },
  "$defs": {
    "BookingRequirements": {
      "type": "object",
      "description": "What the agent must collect from the user BEFORE booking. Contact requirements are provider-derived; AgentBookable never reveals which provider.",
      "properties": {
        "name": {
          "type": "string",
          "enum": [
            "required",
            "optional"
          ],
          "description": "Customer name."
        },
        "email": {
          "type": "string",
          "enum": [
            "required",
            "optional"
          ],
          "description": "Customer email."
        },
        "phone": {
          "type": "string",
          "enum": [
            "required",
            "optional"
          ],
          "description": "Customer phone. 'required' means the booking is rejected without one — collect it first."
        },
        "payment": {
          "type": "boolean",
          "description": "True when payment is required to confirm."
        }
      }
    }
  }
}