"""Shuttle model for intercity and tourist trips."""
from sqlmodel import SQLModel, Field, Column
from datetime import datetime
from typing import Optional
from uuid import UUID, uuid4
from sqlalchemy import DateTime, func


class Shuttle(SQLModel, table=True):
    """Model representing an intercity shuttle or tourist trip."""
    
    __tablename__ = "shuttles"
    
    id: Optional[UUID] = Field(default_factory=uuid4, primary_key=True)
    route_name: str = Field(index=True) # e.g. "Boquete - Santa Catalina"
    description: Optional[str] = None
    origin: str = Field(index=True)
    destination: str = Field(index=True)
    vehicle_type: str # Private Bus, Private Car, Van
    company_name: Optional[str] = None # e.g. "Chiriqui Transfers"
    trip_type: str = "one_way" # one_way, round_trip, both
    price_per_person: Optional[float] = None
    price_private_trip: Optional[float] = None
    estimated_duration: str # e.g. "4.5 hours"
    departure_times: Optional[str] = None # e.g. "Every Day at 8:00 AM"
    contact_whatsapp: str
    phone_number: Optional[str] = None
    english_speaking: bool = Field(default=False)
    image_url: Optional[str] = None
    is_active: bool = Field(default=True)
    created_at: Optional[datetime] = Field(sa_column=Column(DateTime, server_default=func.now()))
    updated_at: Optional[datetime] = Field(sa_column=Column(DateTime, server_default=func.now(), onupdate=func.now()))
