from typing import Optional

from pydantic import BaseModel, EmailStr, Field


class LocalRegisterRequest(BaseModel):
    """Request body for local email/password registration."""

    email: EmailStr
    password: str = Field(..., min_length=8, max_length=128)
    name: Optional[str] = Field(default=None, max_length=255)


class LocalLoginRequest(BaseModel):
    """Request body for local email/password login."""

    email: EmailStr
    password: str = Field(..., min_length=1, max_length=128)


class LocalAuthResponse(BaseModel):
    """Response body for successful local auth."""

    token: str
    token_type: str = "Bearer"
    user_id: str
    email: str
    role: str