from __future__ import annotations

from typing import TYPE_CHECKING, Generic

from pyidentity.abc.user_confirmation import IUserConfirmation
from pyidentity.models import TUser

if TYPE_CHECKING:
    from pyidentity.user_manager import UserManager

__all__ = ["DefaultUserConfirmation"]


class DefaultUserConfirmation(IUserConfirmation[TUser], Generic[TUser]):
    """Default implementation of *IUserConfirmation[TUser]*."""

    async def is_confirmed(self, manager: UserManager[TUser], user: TUser) -> bool:
        return await manager.is_email_confirmed(user)
