from typing import Literal, Optional

from pydantic import BaseModel, Field

IncidentCategory = Literal[
    "derrame", "dano_propiedad", "conducta", "no_recoleccion", "otro"
]
IncidentStatus = Literal["open", "in_review", "resolved"]


class UnitPublic(BaseModel):
    id: int
    plate: Optional[str] = None
    status: Optional[str] = None


class IncidentOut(BaseModel):
    id: int
    user_id: str
    unit_id: Optional[int] = None
    type: IncidentCategory
    description: str
    photo_url: Optional[str] = None
    status: IncidentStatus
    created_at: Optional[str] = None


class IncidentCreate(BaseModel):
    """Payload usado cuando NO se sube foto (JSON)."""
    unit_id: Optional[int] = None
    type: IncidentCategory
    description: str = Field(min_length=3, max_length=1000)
