"""Authentication schemas.

⚠️ AUTO-GENERATED BY PRISM - DO NOT EDIT
Pydantic models for authentication requests and responses.
"""

from __future__ import annotations

from pydantic import BaseModel, {% if is_email %}EmailStr, {% endif %}Field


class LoginRequest(BaseModel):
    """{{ username_field_title }} and password for login."""

    {{ username_field }}: {% if is_email %}EmailStr{% else %}str{% endif %}
    password: str = Field(..., min_length=1)


class SignupRequest(BaseModel):
    """User registration data."""

    {{ username_field }}: {% if is_email %}EmailStr{% else %}str{% endif %}
    password: str = Field(..., min_length=8)


class RefreshTokenRequest(BaseModel):
    """Refresh token request."""

    refresh_token: str


class UserResponse(BaseModel):
    """User data returned in API responses.

    Excludes sensitive fields like password_hash.
    """

    id: int
    {{ username_field }}: str
    is_active: bool
    roles: list[str]

    model_config = {"from_attributes": True}


class TokenResponse(BaseModel):
    """JWT token response."""

    access_token: str
    refresh_token: str
    token_type: str = "bearer"
    user: UserResponse
