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

import enum
import typing

T_Result = typing.TypeVar("T_Result")


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

    PROVIDER_RATE_LIMIT_EXCEEDED = "provider_rate_limit_exceeded"
    PROVIDER_UNAVAILABLE = "provider_unavailable"
    TRANSPORT_FAILURE = "transport_failure"
    RESOURCE_CONTENTION = "resource_contention"
    _UNKNOWN = "__HISTORICALPULLRETRIABLEERRORDETAILS_UNKNOWN__"
    """
    This member is used for forward compatibility. If the value is not recognized by the enum, it will be stored here, and the raw value is accessible through `.value`.
    """

    @classmethod
    def _missing_(cls, value: typing.Any) -> "HistoricalPullRetriableErrorDetails":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        provider_rate_limit_exceeded: typing.Callable[[], T_Result],
        provider_unavailable: typing.Callable[[], T_Result],
        transport_failure: typing.Callable[[], T_Result],
        resource_contention: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is HistoricalPullRetriableErrorDetails.PROVIDER_RATE_LIMIT_EXCEEDED:
            return provider_rate_limit_exceeded()
        if self is HistoricalPullRetriableErrorDetails.PROVIDER_UNAVAILABLE:
            return provider_unavailable()
        if self is HistoricalPullRetriableErrorDetails.TRANSPORT_FAILURE:
            return transport_failure()
        if self is HistoricalPullRetriableErrorDetails.RESOURCE_CONTENTION:
            return resource_contention()
        return _unknown_member(self._value_)
