from typing import Optional from pydantic import BaseModel, Field # Shared properties class InventoryBase(BaseModel): product_id: Optional[int] = None warehouse_id: Optional[int] = None quantity: Optional[int] = Field(0, ge=0) location: Optional[str] = None min_stock_level: Optional[int] = Field(0, ge=0) max_stock_level: Optional[int] = Field(0, ge=0) # Properties to receive via API on creation class InventoryCreate(InventoryBase): product_id: int warehouse_id: int quantity: int # Properties to receive via API on update class InventoryUpdate(InventoryBase): pass class InventoryInDBBase(InventoryBase): id: int class Config: from_attributes = True # Additional properties to return via API class Inventory(InventoryInDBBase): pass # Additional properties stored in DB class InventoryInDB(InventoryInDBBase): pass # Inventory with related product and warehouse information class InventoryWithDetails(Inventory): product_name: str warehouse_name: str