{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/raute-io/json-schema/raute-io-order-schema.json",
  "title": "Order",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/raute-io-openapi.json#/components/schemas/Order",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "order_number": {
      "type": [
        "string",
        "null"
      ]
    },
    "external_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "external_source": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/OrderStatus"
    },
    "customer_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "address": {
      "type": [
        "string",
        "null"
      ]
    },
    "city": {
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "type": [
        "string",
        "null"
      ]
    },
    "zip_code": {
      "type": [
        "string",
        "null"
      ]
    },
    "latitude": {
      "type": [
        "number",
        "null"
      ]
    },
    "longitude": {
      "type": [
        "number",
        "null"
      ]
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "order_type": {
      "type": [
        "string",
        "null"
      ]
    },
    "delivery_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "time_window_start": {
      "type": [
        "string",
        "null"
      ]
    },
    "time_window_end": {
      "type": [
        "string",
        "null"
      ]
    },
    "estimated_arrival": {
      "type": [
        "string",
        "null"
      ]
    },
    "driver_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "delivered_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "delivered_lat": {
      "type": [
        "number",
        "null"
      ]
    },
    "delivered_lng": {
      "type": [
        "number",
        "null"
      ]
    },
    "signature_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "proof_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Photo captured at the door."
    },
    "signed_by_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "signature_required": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "route_index": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Position of this stop on the driver's route."
    },
    "tracking_token": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "OrderStatus": {
      "type": "string",
      "enum": [
        "pending",
        "assigned",
        "in_progress",
        "delivered",
        "cancelled"
      ]
    }
  }
}