from typing import Annotated
from pydantic import BaseModel, BeforeValidator


def is_strong(value: str) -> str:
    if len(value) < 8:
        raise ValueError("Password must be at least 8 characters long")

    return value


class UserCreate(BaseModel):
    email: str
    password: Annotated[str, BeforeValidator(is_strong)]


class UserRead(BaseModel):
    email: str


class UserLogin(BaseModel):
    email: str
    password: str
