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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class WorkflowRunStatus(enum.StrEnum):
    """
    The status of a workflow run:
    * `"PENDING"` - The workflow run is waiting to be processed
    * `"PROCESSING"` - The workflow run is currently processing
    * `"NEEDS_REVIEW"` - The workflow run requires manual review
    * `"REJECTED"` - The workflow run was rejected during review
    * `"PROCESSED"` - The workflow run completed successfully
    * `"FAILED"` - The workflow run encountered an error
    * `"CANCELLED"` - The workflow run was cancelled
    * `"CANCELLING"` - The workflow run is being cancelled
    """

    PENDING = "PENDING"
    PROCESSING = "PROCESSING"
    NEEDS_REVIEW = "NEEDS_REVIEW"
    REJECTED = "REJECTED"
    PROCESSED = "PROCESSED"
    FAILED = "FAILED"
    CANCELLED = "CANCELLED"
    CANCELLING = "CANCELLING"
    _UNKNOWN = "__WORKFLOWRUNSTATUS_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) -> "WorkflowRunStatus":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        pending: typing.Callable[[], T_Result],
        processing: typing.Callable[[], T_Result],
        needs_review: typing.Callable[[], T_Result],
        rejected: typing.Callable[[], T_Result],
        processed: typing.Callable[[], T_Result],
        failed: typing.Callable[[], T_Result],
        cancelled: typing.Callable[[], T_Result],
        cancelling: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is WorkflowRunStatus.PENDING:
            return pending()
        if self is WorkflowRunStatus.PROCESSING:
            return processing()
        if self is WorkflowRunStatus.NEEDS_REVIEW:
            return needs_review()
        if self is WorkflowRunStatus.REJECTED:
            return rejected()
        if self is WorkflowRunStatus.PROCESSED:
            return processed()
        if self is WorkflowRunStatus.FAILED:
            return failed()
        if self is WorkflowRunStatus.CANCELLED:
            return cancelled()
        if self is WorkflowRunStatus.CANCELLING:
            return cancelling()
        return _unknown_member(self._value_)
