{
    "title": "orders",
    "type": "object",
    "properties": {
        "id": {
            "type": "integer",
            "description": "Primary key, auto-increment"
        },
        "user_id": {
            "type": "string",
            "description": "User id, system-managed"
        },
        "order_number": {
            "type": "string",
            "description": "Human-readable order number"
        },
        "status": {
            "type": "string",
            "description": "pending | processing | shipped | delivered | cancelled | refunded"
        },
        "payment_status": {
            "type": "string",
            "description": "pending | paid | failed | refunded"
        },
        "subtotal": {
            "type": "number",
            "description": "Line items subtotal"
        },
        "shipping_cost": {
            "type": "number",
            "description": "Shipping cost"
        },
        "tax": {
            "type": "number",
            "description": "Tax amount"
        },
        "total": {
            "type": "number",
            "description": "Grand total"
        },
        "currency": {
            "type": "string",
            "description": "Currency code"
        },
        "items_json": {
            "type": "string",
            "description": "JSON snapshot of ordered items"
        },
        "shipping_address_json": {
            "type": "string",
            "description": "JSON-encoded shipping address"
        },
        "billing_email": {
            "type": "string",
            "description": "Billing/contact email"
        },
        "stripe_session_id": {
            "type": "string",
            "description": "Stripe checkout session id"
        },
        "payment_method": {
            "type": "string",
            "description": "Payment method used"
        },
        "tracking_number": {
            "type": "string",
            "description": "Shipping tracking number"
        },
        "notes": {
            "type": "string",
            "description": "Customer or admin notes"
        }
    },
    "required": [
        "id",
        "user_id",
        "order_number",
        "status"
    ]
}