from typing import Optional, List from pydantic import BaseModel, Field # Shared properties class InventoryBase(BaseModel): product_id: int quantity: int = Field(..., gt=0) location: Optional[str] = None # Properties to receive on inventory creation class InventoryCreate(InventoryBase): pass # Properties to receive on inventory update class InventoryUpdate(InventoryBase): product_id: Optional[int] = None quantity: Optional[int] = None # Properties shared by models in DB class InventoryInDBBase(InventoryBase): id: int class Config: from_attributes = True # Properties to return via API class Inventory(InventoryInDBBase): pass # Properties for inventory adjustment class InventoryAdjustment(BaseModel): product_id: int quantity: int # Can be positive (add) or negative (remove) reason: str location: Optional[str] = None