from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, EmailStr

from app.models.user import UserRole
from app.schemas.common import EntityRead


class LoginRequest(BaseModel):
    email: EmailStr
    password: str


class TokenResponse(BaseModel):
    access_token: str
    token_type: str = "bearer"
    expires_in: int
    user: UserRead


class UserRead(EntityRead):
    email: EmailStr
    first_name: str
    last_name: str
    role: UserRole
    is_active: bool
    must_change_password: bool
    last_login_at: datetime | None = None
    password_changed_at: datetime | None = None


class ChangePasswordRequest(BaseModel):
    current_password: str
    new_password: str
    new_password_confirmation: str
