{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Forecast",
  "description": "Schema for demand forecast data in Bakery-IA system",
  "type": "object",
  "required": [
    "id",
    "tenant_id",
    "product_id",
    "forecast_date",
    "predicted_quantity",
    "confidence_score",
    "forecast_horizon_days",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the forecast"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid",
      "description": "Tenant identifier"
    },
    "product_id": {
      "type": "string",
      "format": "uuid",
      "description": "Product identifier"
    },
    "forecast_date": {
      "type": "string",
      "format": "date-time",
      "description": "Forecast date"
    },
    "predicted_quantity": {
      "type": "number",
      "minimum": 0,
      "description": "Predicted quantity"
    },
    "confidence_score": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Confidence score (0-1)"
    },
    "forecast_horizon_days": {
      "type": "integer",
      "minimum": 0,
      "description": "Forecast horizon in days"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Creation timestamp"
    },
    "notes": {
      "type": "string",
      "description": "Additional notes"
    },
    "enterprise_forecast": {
      "type": "boolean",
      "description": "Enterprise-level forecast"
    },
    "forecast_type": {
      "type": "string",
      "description": "Type of forecast"
    },
    "contract_reference": {
      "type": "string",
      "description": "Contract reference"
    },
    "customer_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer identifier"
    },
    "delivery_locations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Delivery locations"
    },
    "reasoning_data": {
      "type": "object",
      "description": "Reasoning data for special forecasts",
      "properties": {
        "type": {
          "type": "string",
          "description": "Reasoning type"
        },
        "parameters": {
          "type": "object",
          "description": "Reasoning parameters"
        }
      }
    }
  },
  "additionalProperties": false
}