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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class WebhookSubscriptionEventType(enum.StrEnum):
    """
    Event types available for resource-scoped webhook subscriptions. The valid subset depends on the `resourceType`:

    - **extractor**: `extract_run.processed`, `extract_run.failed`
    - **classifier**: `classify_run.processed`, `classify_run.failed`
    - **splitter**: `split_run.processed`, `split_run.failed`
    - **workflow**: `workflow_run.completed`, `workflow_run.failed`, `workflow_run.needs_review`, `workflow_run.rejected`, `workflow_run.cancelled`, `workflow_run.step_run.processed`
    """

    EXTRACT_RUN_PROCESSED = "extract_run.processed"
    EXTRACT_RUN_FAILED = "extract_run.failed"
    CLASSIFY_RUN_PROCESSED = "classify_run.processed"
    CLASSIFY_RUN_FAILED = "classify_run.failed"
    SPLIT_RUN_PROCESSED = "split_run.processed"
    SPLIT_RUN_FAILED = "split_run.failed"
    WORKFLOW_RUN_COMPLETED = "workflow_run.completed"
    WORKFLOW_RUN_FAILED = "workflow_run.failed"
    WORKFLOW_RUN_NEEDS_REVIEW = "workflow_run.needs_review"
    WORKFLOW_RUN_REJECTED = "workflow_run.rejected"
    WORKFLOW_RUN_CANCELLED = "workflow_run.cancelled"
    WORKFLOW_RUN_STEP_RUN_PROCESSED = "workflow_run.step_run.processed"
    _UNKNOWN = "__WEBHOOKSUBSCRIPTIONEVENTTYPE_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) -> "WebhookSubscriptionEventType":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        extract_run_processed: typing.Callable[[], T_Result],
        extract_run_failed: typing.Callable[[], T_Result],
        classify_run_processed: typing.Callable[[], T_Result],
        classify_run_failed: typing.Callable[[], T_Result],
        split_run_processed: typing.Callable[[], T_Result],
        split_run_failed: typing.Callable[[], T_Result],
        workflow_run_completed: typing.Callable[[], T_Result],
        workflow_run_failed: typing.Callable[[], T_Result],
        workflow_run_needs_review: typing.Callable[[], T_Result],
        workflow_run_rejected: typing.Callable[[], T_Result],
        workflow_run_cancelled: typing.Callable[[], T_Result],
        workflow_run_step_run_processed: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is WebhookSubscriptionEventType.EXTRACT_RUN_PROCESSED:
            return extract_run_processed()
        if self is WebhookSubscriptionEventType.EXTRACT_RUN_FAILED:
            return extract_run_failed()
        if self is WebhookSubscriptionEventType.CLASSIFY_RUN_PROCESSED:
            return classify_run_processed()
        if self is WebhookSubscriptionEventType.CLASSIFY_RUN_FAILED:
            return classify_run_failed()
        if self is WebhookSubscriptionEventType.SPLIT_RUN_PROCESSED:
            return split_run_processed()
        if self is WebhookSubscriptionEventType.SPLIT_RUN_FAILED:
            return split_run_failed()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_COMPLETED:
            return workflow_run_completed()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_FAILED:
            return workflow_run_failed()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_NEEDS_REVIEW:
            return workflow_run_needs_review()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_REJECTED:
            return workflow_run_rejected()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_CANCELLED:
            return workflow_run_cancelled()
        if self is WebhookSubscriptionEventType.WORKFLOW_RUN_STEP_RUN_PROCESSED:
            return workflow_run_step_run_processed()
        return _unknown_member(self._value_)
