76 lines
1.4 KiB
Python
76 lines
1.4 KiB
Python
from enum import Enum
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Low stock product model
|
|
class LowStockProduct(BaseModel):
|
|
id: str
|
|
name: str
|
|
sku: Optional[str] = None
|
|
current_stock: int
|
|
min_stock_level: Optional[int] = None
|
|
supplier_name: Optional[str] = None
|
|
category_name: Optional[str] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Product value model
|
|
class ProductValue(BaseModel):
|
|
id: str
|
|
name: str
|
|
sku: Optional[str] = None
|
|
current_stock: int
|
|
price: float
|
|
total_value: float
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Inventory value summary
|
|
class InventoryValueSummary(BaseModel):
|
|
total_products: int
|
|
total_items: int
|
|
total_value: float
|
|
average_item_value: float
|
|
by_category: List["CategoryValue"] = []
|
|
|
|
|
|
# Category value model
|
|
class CategoryValue(BaseModel):
|
|
id: str
|
|
name: str
|
|
product_count: int
|
|
total_items: int
|
|
total_value: float
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Time period enum for inventory movement reports
|
|
class TimePeriod(str, Enum):
|
|
DAY = "day"
|
|
WEEK = "week"
|
|
MONTH = "month"
|
|
YEAR = "year"
|
|
ALL = "all"
|
|
|
|
|
|
# Inventory movement summary model
|
|
class MovementSummary(BaseModel):
|
|
period: str
|
|
stock_in: int
|
|
stock_out: int
|
|
adjustments: int
|
|
returns: int
|
|
net_change: int
|
|
|
|
|
|
# Update recursive references
|
|
InventoryValueSummary.model_rebuild()
|