"""
认证相关 Schema
"""
from pydantic import EmailStr, Field

from .base import BaseSchema


class LoginRequest(BaseSchema):
    """登录请求"""

    username: str = Field(..., description="用户名/邮箱/手机号")
    password: str = Field(..., min_length=6)


class Token(BaseSchema):
    """令牌响应"""

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


class TokenPayload(BaseSchema):
    """令牌载荷"""

    sub: str  # 用户ID
    type: str  # access 或 refresh
    exp: int  # 过期时间


class RefreshTokenRequest(BaseSchema):
    """刷新令牌请求"""

    refresh_token: str
