{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/simpledock-ai/json-schema/simpledock-ai-appointment-schema.json",
  "title": "Appointment",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/simpledock-ai-openapi.yml#/components/schemas/Appointment",
  "type": "object",
  "required": [
    "id",
    "status",
    "locationId",
    "startTime",
    "endTime",
    "companyName",
    "contactEmail",
    "customFields",
    "poNumbers",
    "createdAt",
    "updatedAt",
    "door",
    "appointmentType"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING",
        "CONFIRMED",
        "CANCELLED",
        "COMPLETED",
        "NO_SHOW"
      ]
    },
    "locationId": {
      "type": "string"
    },
    "startTime": {
      "type": "string",
      "format": "date-time"
    },
    "endTime": {
      "type": "string",
      "format": "date-time"
    },
    "companyName": {
      "type": "string"
    },
    "contactEmail": {
      "type": "string",
      "description": "An empty string for a quiet booking made without an email."
    },
    "contactName": {
      "type": [
        "string",
        "null"
      ]
    },
    "externalSource": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ouroboros",
        "opendock",
        null
      ],
      "description": "The system that made or imported the booking, if any."
    },
    "externalRef": {
      "type": [
        "string",
        "null"
      ],
      "description": "That system's id for the booking."
    },
    "contactPhone": {
      "type": [
        "string",
        "null"
      ]
    },
    "driverName": {
      "type": [
        "string",
        "null"
      ]
    },
    "driverPhone": {
      "type": [
        "string",
        "null"
      ]
    },
    "trailerNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "poReference": {
      "type": [
        "string",
        "null"
      ],
      "description": "First purchase order. Kept for clients that read a single string. The full list is poNumbers."
    },
    "poNumbers": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every purchase order on the appointment, in order."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "driverNotes": {
      "type": [
        "string",
        "null"
      ]
    },
    "customFields": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "arrivalStatus": {
      "type": [
        "string",
        "null"
      ]
    },
    "estimatedDelay": {
      "type": [
        "integer",
        "null"
      ]
    },
    "approvedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "rejectedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "cancelledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "checkedInAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When dock staff marked the truck arrived."
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the appointment was marked completed (the truck left)."
    },
    "rejectionReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "seriesId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when staff booked this as part of a recurring series."
    },
    "needsDetails": {
      "type": "boolean",
      "description": "A recurring appointment booked ahead with required details (PO, booking questions) still blank. The booker is emailed to fill them in."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "door": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "appointmentType": {
      "$ref": "#/$defs/AppointmentTypeSummary"
    }
  },
  "$defs": {
    "AppointmentTypeSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "loadType": {
          "type": "string"
        },
        "direction": {
          "type": "string"
        },
        "durationMinutes": {
          "type": "integer"
        }
      }
    }
  }
}