from pydantic import BaseModel, Field from datetime import datetime from typing import Optional class ServerTimeBase(BaseModel): timezone: str = Field(default="UTC", description="Timezone for the server") class ServerTimeCreate(ServerTimeBase): current_time: Optional[datetime] = Field(default_factory=datetime.now, description="Current server time") class Config: schema_extra = { "example": { "current_time": "2024-01-01T12:00:00", "timezone": "UTC" } } class ServerTime(ServerTimeBase): current_time: datetime = Field(..., description="Current server time") class Config: orm_mode = True schema_extra = { "example": { "current_time": "2024-01-01T12:00:00", "timezone": "UTC" } }