from datetime import date

from pydantic import BaseModel, EmailStr
from fastapi import Query


class SUserLogin(BaseModel):
    email_or_username: EmailStr | str
    password: str


class SUserRegister(BaseModel):
    email: EmailStr
    username: str = Query(None, min_length=2, max_length=30)
    password: str = Query(None, min_length=8)
    date_of_birth: date


class SUser(BaseModel):
    email: EmailStr
    id: int
    username: str
    avatar_image: str
    black_phoenix: bool
    date_of_birth: date
    date_of_registration: date

    class Config:
        from_attributes = True


class SUserName(BaseModel):
    username: str = Query(None, min_length=2, max_length=30)


class SUserPassword(BaseModel):
    password: str = Query(None, min_length=8)
    new_password: str = Query(None, min_length=8)
    new_password2: str = Query(None, min_length=8)

