{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "SalesData",
  "description": "Schema for sales data in Bakery-IA system",
  "type": "object",
  "required": [
    "id",
    "tenant_id",
    "sale_date",
    "product_id",
    "quantity_sold",
    "unit_price",
    "total_revenue",
    "sales_channel",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the sales record"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid",
      "description": "Tenant identifier"
    },
    "sale_date": {
      "type": "string",
      "format": "date-time",
      "description": "Sale date"
    },
    "product_id": {
      "type": "string",
      "format": "uuid",
      "description": "Product identifier"
    },
    "quantity_sold": {
      "type": "number",
      "minimum": 0,
      "description": "Quantity sold"
    },
    "unit_price": {
      "type": "number",
      "minimum": 0,
      "description": "Unit price in EUR"
    },
    "total_revenue": {
      "type": "number",
      "minimum": 0,
      "description": "Total revenue in EUR"
    },
    "sales_channel": {
      "type": "string",
      "enum": ["IN_STORE", "ONLINE", "WHOLESALE", "ENTERPRISE", "OTHER"],
      "description": "Sales channel"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Creation timestamp"
    },
    "notes": {
      "type": "string",
      "description": "Additional notes"
    },
    "enterprise_sale": {
      "type": "boolean",
      "description": "Enterprise-level sale"
    },
    "customer_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer identifier"
    },
    "contract_reference": {
      "type": "string",
      "description": "Contract reference"
    },
    "delivery_locations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Delivery locations"
    },
    "reasoning_data": {
      "type": "object",
      "description": "Reasoning data for special sales",
      "properties": {
        "type": {
          "type": "string",
          "description": "Reasoning type"
        },
        "parameters": {
          "type": "object",
          "description": "Reasoning parameters"
        }
      }
    }
  },
  "additionalProperties": false
}