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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class LegacyProcessorStatus(enum.StrEnum):
    """
    The status of a processor run:
    * `"PENDING"` - The processor run has not started yet
    * `"PROCESSING"` - The processor run is in progress
    * `"PROCESSED"` - The processor run completed successfully
    * `"FAILED"` - The processor run failed
    * `"CANCELLED"` - The processor run was cancelled
    """

    PENDING = "PENDING"
    PROCESSING = "PROCESSING"
    PROCESSED = "PROCESSED"
    FAILED = "FAILED"
    CANCELLED = "CANCELLED"
    _UNKNOWN = "__LEGACYPROCESSORSTATUS_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) -> "LegacyProcessorStatus":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        pending: typing.Callable[[], T_Result],
        processing: typing.Callable[[], T_Result],
        processed: typing.Callable[[], T_Result],
        failed: typing.Callable[[], T_Result],
        cancelled: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is LegacyProcessorStatus.PENDING:
            return pending()
        if self is LegacyProcessorStatus.PROCESSING:
            return processing()
        if self is LegacyProcessorStatus.PROCESSED:
            return processed()
        if self is LegacyProcessorStatus.FAILED:
            return failed()
        if self is LegacyProcessorStatus.CANCELLED:
            return cancelled()
        return _unknown_member(self._value_)
