from typing import Optional from pydantic import EmailStr from app.schemas.base import BaseSchema class UserBase(BaseSchema): """ Base schema for a user. """ email: Optional[EmailStr] = None username: Optional[str] = None is_active: Optional[bool] = True is_superuser: bool = False class UserCreate(UserBase): """ Schema for creating a new user. """ email: EmailStr username: str password: str class UserUpdate(UserBase): """ Schema for updating a user. """ password: Optional[str] = None class UserInDBBase(UserBase): """ Schema for a user in the database. """ id: int email: EmailStr username: str class User(UserInDBBase): """ Schema for returning a user. """ pass class UserInDB(UserInDBBase): """ Schema for a user in the database with the hashed password. """ hashed_password: str