import typing as t

if t.TYPE_CHECKING:
    from .other import DB_AccessToken, DB_APIKey
    from .discussions import DB_Discussion

from datetime import datetime

from sqlmodel import SQLModel, Field, Relationship, Column, JSON
from ..extensions.tags import DB_Tag, DB_TagUser



class DB_User(SQLModel, table=True):
    __tablename__ = 'users'
    id: t.Optional[int] = Field(default=None, primary_key=True)
    """The ID of the user. This is handled by the database."""

    username: str = Field(max_length=100, sa_column_kwargs={"unique": True})
    """The user's username."""

    email: str = Field(max_length=150, sa_column_kwargs={"unique": True})
    """The user's E-mail address."""
    is_email_confirmed: bool = Field(default=False)
    """Whether or not the user confirmed their E-mail address."""
    password: str = Field(max_length=100)
    """The user's password (<PASSWORD>)."""

    avatar_url: t.Optional[str] = 