# This file was auto-generated by Fern from our API Definition.

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class ProviderConnectionErrorErrorType(str, enum.Enum):
    """
    ℹ️ This enum is non-exhaustive.
    """

    TOKEN_REFRESH_FAILED = "token_refresh_failed"
    WEBHOOK_REGISTRATION_FAILED = "webhook_registration_failed"
    USER_NOT_FOUND = "user_not_found"
    DEREGISTERED_PER_PROVIDER = "deregistered_per_provider"
    REQUIRED_SCOPES_NOT_GRANTED = "required_scopes_not_granted"
    PROVIDER_CREDENTIAL_ERROR = "provider_credential_error"
    UNKNOWN = "unknown"

    def visit(
        self,
        token_refresh_failed: typing.Callable[[], T_Result],
        webhook_registration_failed: typing.Callable[[], T_Result],
        user_not_found: typing.Callable[[], T_Result],
        deregistered_per_provider: typing.Callable[[], T_Result],
        required_scopes_not_granted: typing.Callable[[], T_Result],
        provider_credential_error: typing.Callable[[], T_Result],
        unknown: typing.Callable[[], T_Result],
    ) -> T_Result:
        if self is ProviderConnectionErrorErrorType.TOKEN_REFRESH_FAILED:
            return token_refresh_failed()
        if self is ProviderConnectionErrorErrorType.WEBHOOK_REGISTRATION_FAILED:
            return webhook_registration_failed()
        if self is ProviderConnectionErrorErrorType.USER_NOT_FOUND:
            return user_not_found()
        if self is ProviderConnectionErrorErrorType.DEREGISTERED_PER_PROVIDER:
            return deregistered_per_provider()
        if self is ProviderConnectionErrorErrorType.REQUIRED_SCOPES_NOT_GRANTED:
            return required_scopes_not_granted()
        if self is ProviderConnectionErrorErrorType.PROVIDER_CREDENTIAL_ERROR:
            return provider_credential_error()
        if self is ProviderConnectionErrorErrorType.UNKNOWN:
            return unknown()
