from pydantic import BaseModel from typing import Optional, List class CategoryBase(BaseModel): name: str color: Optional[str] = None sort_order: int = 0 class CategoryCreate(CategoryBase): pass class CategoryUpdate(BaseModel): name: Optional[str] = None color: Optional[str] = None sort_order: Optional[int] = None class CategoryOut(CategoryBase): id: int model_config = {"from_attributes": True} class ProductOptionBase(BaseModel): name: str extra_cost: float = 0.0 class ProductOptionCreate(ProductOptionBase): pass class ProductOptionOut(ProductOptionBase): id: int product_id: int model_config = {"from_attributes": True} class ProductIngredientBase(BaseModel): name: str class ProductIngredientCreate(ProductIngredientBase): pass class ProductIngredientOut(ProductIngredientBase): id: int product_id: int model_config = {"from_attributes": True} class ProductBase(BaseModel): name: str category_id: Optional[int] = None base_price: float is_available: bool = True printer_zone_id: Optional[int] = None class ProductCreate(ProductBase): options: List[ProductOptionCreate] = [] ingredients: List[ProductIngredientCreate] = [] class ProductUpdate(BaseModel): name: Optional[str] = None category_id: Optional[int] = None base_price: Optional[float] = None is_available: Optional[bool] = None printer_zone_id: Optional[int] = None class ProductOut(ProductBase): id: int options: List[ProductOptionOut] = [] ingredients: List[ProductIngredientOut] = [] model_config = {"from_attributes": True}