from typing import Optional

from pydantic import BaseModel, Field


class VehicleBaseDTO(BaseModel):
    vehicle_key: str = Field(..., description="Vehicle key (primary identifier)")
    vehicle_id: Optional[int] = Field(None, description="Internal vehicle integer ID")
    ace_vehicle_key: Optional[str] = None
    transporter_key: Optional[str] = None
    transport_identifier: Optional[str] = None
    transport_type: Optional[str] = None
    entity_code: Optional[str] = None
    transponder_number: Optional[str] = None
    dot_number: Optional[str] = None
    plate_number: Optional[str] = None
    city: Optional[str] = None
    state: Optional[str] = None
    country: Optional[str] = None
    seal: Optional[str] = None
    insurance_company_name: Optional[str] = None
    insurance_number: Optional[str] = None
    insurance_amount: Optional[float] = None
    insurance_date: Optional[int] = None
    box_number: Optional[str] = None
    brand: Optional[str] = None
    year: Optional[str] = None
    series: Optional[str] = None
    description: Optional[str] = None
    engine_number: Optional[str] = None
    sct_permission: Optional[str] = None
    color: Optional[str] = None
    container_key: Optional[str] = None


class VehicleCreateDTO(VehicleBaseDTO):
    """Schema for creating a vehicle"""
    pass


class VehicleUpdateDTO(VehicleBaseDTO):
    """Schema for updating a vehicle"""
    vehicle_key: Optional[str] = Field(None, description="Vehicle key (cannot be modified)")


class VehicleResponseDTO(VehicleBaseDTO):
    """Schema for vehicle response"""
    company_id: int
    tenant_id: int

    class Config:
        from_attributes = True
