from pydantic import BaseModel
from typing import Optional


class RouteResponse(BaseModel):
    origin: str
    dest: str
    flight_count: int = 0
    avg_delay: Optional[float] = None
    pct_delayed: Optional[float] = None
    delay_risk: Optional[str] = None
    avg_distance: Optional[float] = None
    avg_carrier_delay: Optional[float] = None
    avg_weather_delay: Optional[float] = None
    avg_nas_delay: Optional[float] = None
    avg_late_aircraft_delay: Optional[float] = None

    class Config:
        from_attributes = True


class RouteListResponse(BaseModel):
    routes: list[RouteResponse]
    count: int
