diff --git a/schemas/ride.py b/schemas/ride.py new file mode 100644 index 0000000..ed8880b --- /dev/null +++ b/schemas/ride.py @@ -0,0 +1,29 @@ +from pydantic import BaseModel, Field +from typing import Optional +from datetime import datetime +from uuid import UUID + +class RideBase(BaseModel): + pickup_location: str = Field(..., description="Pickup location") + drop_location: str = Field(..., description="Drop-off location") + pickup_latitude: float = Field(..., description="Pickup latitude") + pickup_longitude: float = Field(..., description="Pickup longitude") + drop_latitude: float = Field(..., description="Drop-off latitude") + drop_longitude: float = Field(..., description="Drop-off longitude") + rider_id: UUID = Field(..., description="ID of the rider") + +class RideCreate(RideBase): + pass + +class RideSchema(RideBase): + id: UUID + driver_id: Optional[UUID] = Field(None, description="ID of the driver") + ride_status: str = Field("requested", description="Status of the ride") + ride_distance: Optional[float] = Field(None, description="Distance of the ride") + ride_duration: Optional[int] = Field(None, description="Duration of the ride") + ride_fare: Optional[float] = Field(None, description="Fare for the ride") + created_at: datetime + updated_at: datetime + + class Config: + orm_mode = True \ No newline at end of file