from pydantic import BaseModel

from service.api.models.generic import ValidEmail

__all__ = ["UsersPublic", "UserMe", "UserPublic", "UpdatePassword", "UserUpdate", "UserCreate", "UserRegister"]


class UserBase(BaseModel):
    email: ValidEmail
    username: str
    is_superuser: bool = False


class UserCreate(UserBase):
    password: str


class UserRegister(BaseModel):
    email: ValidEmail
    username: str
    password: str


class UserUpdate(UserBase):
    email: ValidEmail | None = None  # type: ignore
    username: str
    password: str | None = None


class UpdatePassword(BaseModel):
    current_password: str
    new_password: str
    new_password_repeat: str


class UserPublic(BaseModel):
    id: int
    username: str


class UserMe(UserBase):
    id: int
    username: str


class UsersPublic(BaseModel):
    data: list[UserPublic]
    count: int
