from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Generic

from pyidentity.models import TUser

if TYPE_CHECKING:
    from pyidentity.security.claims import ClaimsPrincipal

__all__ = ["IUserClaimsPrincipalFactory"]


class IUserClaimsPrincipalFactory(Generic[TUser], ABC):
    """Provides an abstraction for a factory to create a *ClaimsIdentity* from a user."""

    @abstractmethod
    async def create(self, user: TUser) -> ClaimsPrincipal:
        """Creates a *ClaimsPrincipal* from a user.

        :param user: The user to create a *ClaimsPrincipal* from.
        :return:
        """
