"""Схемы запросов и ответов аутентификации.""" from __future__ import annotations import uuid from pydantic import BaseModel, ConfigDict, EmailStr, Field from app.db.models.user import UserRole class LoginRequest(BaseModel): email: EmailStr password: str = Field(min_length=1, max_length=128) class RefreshRequest(BaseModel): refresh_token: str = Field(min_length=1) class TokenPair(BaseModel): access_token: str refresh_token: str token_type: str = "bearer" expires_in: int = Field(description="Час життя access-токена в секундах") class UserOut(BaseModel): model_config = ConfigDict(from_attributes=True) id: uuid.UUID email: EmailStr full_name: str role: UserRole is_active: bool class LoginResponse(TokenPair): user: UserOut class ChangePasswordRequest(BaseModel): current_password: str = Field(min_length=1, max_length=128) new_password: str = Field(min_length=10, max_length=128)