from pydantic import BaseModel, EmailStr, Field
from typing import Optional
from datetime import datetime


class UserResponseModel(BaseModel):
    id: Optional[str] = Field(alias="_id")
    google_id: Optional[str] = None
    email: EmailStr
    name: str
    birth_date: Optional[datetime] = None
    pic_url: Optional[str] = None
    phone: Optional[str] = None
    locale: str

    class ConfigDict:
        populate_by_name = True
        json_encoders = {
            datetime: lambda v: v.isoformat(),
        }
