from pydantic import BaseModel, Field from datetime import datetime from schemas.user import ShowDriver from typing import Optional class CreateTask(BaseModel): DriverId: int = Field() Description: str = Field(..., min_length=3, max_length=200) StartLocation: tuple[str, str] = Field(...) EndLocation: tuple[str, str] = Field(...) class ShowTask(BaseModel): Id: int Driver: Optional[ShowDriver] Description: str Status: str StartLocation: tuple[str, str] EndLocation: tuple[str, str] StartDateTime: Optional[datetime] DistanceCovered: Optional[float] EndDateTime: Optional[datetime] class Config: orm_mode = True