{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.bakery-ia.com/demo/recipes/recipe/v1",
  "type": "object",
  "title": "Recipe",
  "description": "Recipe for demo cloning",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique recipe identifier"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid",
      "description": "Tenant owner (replaced during cloning)"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "recipe_code": {
      "type": ["string", "null"],
      "maxLength": 100
    },
    "version": {
      "type": "string",
      "default": "1.0"
    },
    "finished_product_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cross-service ref to inventory.Ingredient (product_type=finished_product)"
    },
    "description": {
      "type": ["string", "null"]
    },
    "category": {
      "type": ["string", "null"],
      "maxLength": 100
    },
    "cuisine_type": {
      "type": ["string", "null"],
      "maxLength": 100
    },
    "difficulty_level": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5,
      "default": 1
    },
    "yield_quantity": {
      "type": "number",
      "minimum": 0.1
    },
    "yield_unit": {
      "type": "string",
      "enum": ["g", "kg", "ml", "l", "cups", "tbsp", "tsp", "units", "pieces", "%"]
    },
    "prep_time_minutes": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "cook_time_minutes": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "total_time_minutes": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "rest_time_minutes": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "estimated_cost_per_unit": {
      "type": ["number", "null"],
      "minimum": 0
    },
    "last_calculated_cost": {
      "type": ["number", "null"],
      "minimum": 0
    },
    "cost_calculation_date": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "target_margin_percentage": {
      "type": ["number", "null"],
      "minimum": 0,
      "maximum": 100
    },
    "suggested_selling_price": {
      "type": ["number", "null"],
      "minimum": 0
    },
    "instructions": {
      "type": ["object", "null"]
    },
    "preparation_notes": {
      "type": ["string", "null"]
    },
    "storage_instructions": {
      "type": ["string", "null"]
    },
    "serves_count": {
      "type": ["integer", "null"],
      "minimum": 1
    },
    "nutritional_info": {
      "type": ["object", "null"]
    },
    "allergen_info": {
      "type": ["array", "null"],
      "items": {"type": "string"}
    },
    "dietary_tags": {
      "type": ["array", "null"],
      "items": {"type": "string"}
    },
    "batch_size_multiplier": {
      "type": "number",
      "minimum": 0.1,
      "default": 1.0
    },
    "minimum_batch_size": {
      "type": ["number", "null"],
      "minimum": 0.1
    },
    "maximum_batch_size": {
      "type": ["number", "null"],
      "minimum": 0.1
    },
    "optimal_production_temperature": {
      "type": ["number", "null"]
    },
    "optimal_humidity": {
      "type": ["number", "null"],
      "minimum": 0,
      "maximum": 100
    },
    "quality_check_configuration": {
      "type": ["object", "null"]
    },
    "status": {
      "type": "string",
      "enum": ["DRAFT", "ACTIVE", "TESTING", "ARCHIVED", "DISCONTINUED"],
      "default": "DRAFT"
    },
    "is_seasonal": {
      "type": "boolean",
      "default": false
    },
    "season_start_month": {
      "type": ["integer", "null"],
      "minimum": 1,
      "maximum": 12
    },
    "season_end_month": {
      "type": ["integer", "null"],
      "minimum": 1,
      "maximum": 12
    },
    "is_signature_item": {
      "type": "boolean",
      "default": false
    },
    "created_at": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "updated_at": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "created_by": {
      "type": ["string", "null"],
      "format": "uuid"
    },
    "updated_by": {
      "type": ["string", "null"],
      "format": "uuid"
    }
  },
  "required": [
    "id", "tenant_id", "name", "finished_product_id", "yield_quantity", "yield_unit",
    "status", "is_seasonal", "is_signature_item", "batch_size_multiplier"
  ],
  "additionalProperties": false
}