{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PurchaseOrderItem",
  "description": "Schema for purchase order item data in Bakery-IA system",
  "type": "object",
  "required": [
    "id",
    "tenant_id",
    "po_id",
    "ingredient_id",
    "quantity",
    "unit_price",
    "total_price",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the purchase order item"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid",
      "description": "Tenant identifier"
    },
    "po_id": {
      "type": "string",
      "format": "uuid",
      "description": "Purchase order identifier"
    },
    "ingredient_id": {
      "type": "string",
      "format": "uuid",
      "description": "Ingredient identifier"
    },
    "quantity": {
      "type": "number",
      "minimum": 0,
      "description": "Quantity ordered"
    },
    "unit_price": {
      "type": "number",
      "minimum": 0,
      "description": "Unit price in EUR"
    },
    "total_price": {
      "type": "number",
      "minimum": 0,
      "description": "Total price in EUR"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Creation timestamp"
    },
    "notes": {
      "type": "string",
      "description": "Additional notes"
    },
    "enterprise_item": {
      "type": "boolean",
      "description": "Enterprise-level item"
    },
    "delivery_schedule": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "delivery_date": {
            "type": "string",
            "format": "date-time"
          },
          "quantity": {
            "type": "number",
            "minimum": 0
          },
          "location": {
            "type": "string"
          }
        }
      },
      "description": "Delivery schedule"
    }
  },
  "additionalProperties": false
}