from typing import override

from template_project.application.auth_identity.entity import AuthMethod
from template_project.application.common.errors import ApplicationError, to_error


@to_error
class UserAlreadyExistsError(ApplicationError):
    identifier: str
    auth_method: AuthMethod

    @override
    def __str__(self) -> str:
        return f"User with identifier={self.identifier!r} and auth method={self.auth_method.value} already exists"


@to_error
class AuthError(ApplicationError):
    pass


@to_error
class InvalidCodeError(ApplicationError):
    pass


@to_error
class InvalidCredentialsError(ApplicationError):
    pass


@to_error
class UserNotFoundError(ApplicationError):
    pass
