from datetime import datetime

from pydantic import BaseModel, ConfigDict


class CaseResponse(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: int
    reference: str | None
    account_id: int | None
    title: str | None
    stage: str
    status: str
    tenant_id: int
    company_id: int
    created_at: datetime
    updated_at: datetime


class CaseTimelineEvent(BaseModel):
    kind: str            # oportunidad | solicitud | cotizacion | operacion | factura
    id: int
    reference: str | None = None
    status: str | None = None
    created_at: datetime
    url: str


class CaseWithTimeline(CaseResponse):
    timeline: list[CaseTimelineEvent] = []
