"""Authentication schemas.""" from datetime import datetime from typing import Optional from pydantic import BaseModel, EmailStr, Field class UserCreate(BaseModel): """Schema for user registration.""" email: EmailStr password: str = Field(..., min_length=8, max_length=100) name: Optional[str] = Field(None, max_length=100) # Yield referral tracking ref: Optional[str] = Field(None, max_length=100, description="Referral code from yield domain") class UserLogin(BaseModel): """Schema for user login.""" email: EmailStr password: str class UserResponse(BaseModel): """Schema for user response.""" id: int email: str name: Optional[str] is_active: bool is_verified: bool is_admin: bool = False created_at: datetime class Config: from_attributes = True class Token(BaseModel): """Schema for JWT token response.""" access_token: str token_type: str = "bearer" expires_in: int class LoginResponse(BaseModel): """Login response when using HttpOnly cookie authentication.""" expires_in: int class TokenData(BaseModel): """Schema for token payload data.""" user_id: Optional[int] = None email: Optional[str] = None