{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.bakery-ia.com/demo/inventory/ingredient/v1", "type": "object", "title": "Ingredient", "description": "Ingredient or finished product for demo cloning", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique ingredient identifier" }, "tenant_id": { "type": "string", "format": "uuid", "description": "Tenant owner (replaced during cloning)" }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "sku": { "type": ["string", "null"], "maxLength": 100 }, "barcode": { "type": ["string", "null"], "maxLength": 50 }, "product_type": { "type": "string", "enum": ["ingredient", "finished_product"], "description": "Type of product in inventory" }, "ingredient_category": { "type": ["string", "null"], "enum": ["flour", "yeast", "dairy", "eggs", "sugar", "fats", "salt", "spices", "additives", "packaging", "cleaning", "other"] }, "product_category": { "type": ["string", "null"], "enum": ["bread", "croissants", "pastries", "cakes", "cookies", "muffins", "sandwiches", "seasonal", "beverages", "other_products"] }, "subcategory": { "type": ["string", "null"], "maxLength": 100 }, "description": { "type": ["string", "null"] }, "brand": { "type": ["string", "null"], "maxLength": 100 }, "unit_of_measure": { "type": "string", "enum": ["kg", "g", "l", "ml", "units", "pcs", "pkg", "bags", "boxes"] }, "package_size": { "type": ["number", "null"], "minimum": 0 }, "average_cost": { "type": ["number", "null"], "minimum": 0 }, "last_purchase_price": { "type": ["number", "null"], "minimum": 0 }, "standard_cost": { "type": ["number", "null"], "minimum": 0 }, "low_stock_threshold": { "type": ["number", "null"], "minimum": 0 }, "reorder_point": { "type": ["number", "null"], "minimum": 0 }, "reorder_quantity": { "type": ["number", "null"], "minimum": 0 }, "max_stock_level": { "type": ["number", "null"], "minimum": 0 }, "shelf_life_days": { "type": ["integer", "null"], "minimum": 1 }, "display_life_hours": { "type": ["integer", "null"], "minimum": 1 }, "best_before_hours": { "type": ["integer", "null"], "minimum": 1 }, "storage_instructions": { "type": ["string", "null"] }, "central_baker_product_code": { "type": ["string", "null"], "maxLength": 100 }, "delivery_days": { "type": ["string", "null"], "maxLength": 20 }, "minimum_order_quantity": { "type": ["number", "null"], "minimum": 0 }, "pack_size": { "type": ["integer", "null"], "minimum": 1 }, "is_active": { "type": "boolean", "default": true }, "is_perishable": { "type": "boolean", "default": false }, "allergen_info": { "type": ["array", "null"], "items": {"type": "string"} }, "nutritional_info": { "type": ["object", "null"] }, "produced_locally": { "type": "boolean", "default": false }, "recipe_id": { "type": ["string", "null"], "format": "uuid", "description": "Cross-service ref to recipes.Recipe for local production" }, "created_at": { "type": ["string", "null"], "format": "date-time" }, "updated_at": { "type": ["string", "null"], "format": "date-time" }, "created_by": { "type": ["string", "null"], "format": "uuid" } }, "required": [ "id", "tenant_id", "name", "product_type", "unit_of_measure", "is_active", "is_perishable", "produced_locally" ], "additionalProperties": false, "allOf": [ { "if": { "properties": {"product_type": {"const": "finished_product"}} }, "then": { "required": ["product_category"] } }, { "if": { "properties": {"product_type": {"const": "ingredient"}} }, "then": { "required": ["ingredient_category"] } } ] }