from pydantic import BaseModel
from typing import Optional
from datetime import datetime

VALID_REASONS = {"kitchen_error", "dropped", "expired", "other"}

REASON_LABELS = {
    "kitchen_error": "Λάθος κουζίνας",
    "dropped":       "Έπεσε",
    "expired":       "Έληξε",
    "other":         "Άλλο",
}


class WasteLogCreate(BaseModel):
    product_id: int
    quantity: float
    reason: str
    reason_notes: Optional[str] = None


class WasteLogOut(BaseModel):
    id: int
    product_id: int
    product_name: Optional[str] = None
    quantity: float
    unit_cost_snapshot: Optional[float] = None
    total_cost: Optional[float] = None
    reason: str
    reason_label: Optional[str] = None
    reason_notes: Optional[str] = None
    logged_by_id: int
    logged_by_name: Optional[str] = None
    business_day_id: Optional[int] = None
    logged_at: datetime

    model_config = {"from_attributes": True}
