from typing import Optional from pydantic import BaseModel # Shared properties class ProductBase(BaseModel): name: Optional[str] = None description: Optional[str] = None sku: Optional[str] = None barcode: Optional[str] = None price: Optional[float] = 0.0 cost: Optional[float] = 0.0 min_stock_level: Optional[int] = 0 is_active: Optional[bool] = True category_id: Optional[int] = None supplier_id: Optional[int] = None # Properties to receive on product creation class ProductCreate(ProductBase): name: str sku: str # Properties to receive on product update class ProductUpdate(ProductBase): pass # Properties shared by models in DB class ProductInDBBase(ProductBase): id: int name: str sku: str class Config: from_attributes = True # Properties to return to client class Product(ProductInDBBase): pass # Properties properties stored in DB class ProductInDB(ProductInDBBase): pass