from typing import Optional
from pydantic import BaseModel, Field, ConfigDict
from datetime import datetime
from .base import PyObjectId


class UserEntity(BaseModel):
    id: Optional[PyObjectId] = Field(default=None, alias="_id")
    google_id: Optional[str] = None
    email: str
    password: Optional[str] = None
    name: str
    birth_date: Optional[datetime] = None
    pic_url: Optional[str] = None
    phone: Optional[str] = None
    locale: str = "en-US"
    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None

    model_config = ConfigDict(populate_by_name=True, json_encoders={PyObjectId: str})
