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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class WebhookEndpointEventType(enum.StrEnum):
    """
    Event types available for webhook endpoints at the global level. Includes run events and resource lifecycle events.
    """

    PARSE_RUN_PROCESSED = "parse_run.processed"
    PARSE_RUN_FAILED = "parse_run.failed"
    EDIT_RUN_PROCESSED = "edit_run.processed"
    EDIT_RUN_FAILED = "edit_run.failed"
    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"
    EXTRACTOR_CREATED = "extractor.created"
    EXTRACTOR_UPDATED = "extractor.updated"
    EXTRACTOR_DELETED = "extractor.deleted"
    EXTRACTOR_DRAFT_UPDATED = "extractor.draft.updated"
    EXTRACTOR_VERSION_PUBLISHED = "extractor.version.published"
    CLASSIFIER_CREATED = "classifier.created"
    CLASSIFIER_UPDATED = "classifier.updated"
    CLASSIFIER_DELETED = "classifier.deleted"
    CLASSIFIER_DRAFT_UPDATED = "classifier.draft.updated"
    CLASSIFIER_VERSION_PUBLISHED = "classifier.version.published"
    SPLITTER_CREATED = "splitter.created"
    SPLITTER_UPDATED = "splitter.updated"
    SPLITTER_DELETED = "splitter.deleted"
    SPLITTER_DRAFT_UPDATED = "splitter.draft.updated"
    SPLITTER_VERSION_PUBLISHED = "splitter.version.published"
    WORKFLOW_CREATED = "workflow.created"
    WORKFLOW_DEPLOYED = "workflow.deployed"
    WORKFLOW_DELETED = "workflow.deleted"
    _UNKNOWN = "__WEBHOOKENDPOINTEVENTTYPE_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) -> "WebhookEndpointEventType":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        parse_run_processed: typing.Callable[[], T_Result],
        parse_run_failed: typing.Callable[[], T_Result],
        edit_run_processed: typing.Callable[[], T_Result],
        edit_run_failed: typing.Callable[[], T_Result],
        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],
        extractor_created: typing.Callable[[], T_Result],
        extractor_updated: typing.Callable[[], T_Result],
        extractor_deleted: typing.Callable[[], T_Result],
        extractor_draft_updated: typing.Callable[[], T_Result],
        extractor_version_published: typing.Callable[[], T_Result],
        classifier_created: typing.Callable[[], T_Result],
        classifier_updated: typing.Callable[[], T_Result],
        classifier_deleted: typing.Callable[[], T_Result],
        classifier_draft_updated: typing.Callable[[], T_Result],
        classifier_version_published: typing.Callable[[], T_Result],
        splitter_created: typing.Callable[[], T_Result],
        splitter_updated: typing.Callable[[], T_Result],
        splitter_deleted: typing.Callable[[], T_Result],
        splitter_draft_updated: typing.Callable[[], T_Result],
        splitter_version_published: typing.Callable[[], T_Result],
        workflow_created: typing.Callable[[], T_Result],
        workflow_deployed: typing.Callable[[], T_Result],
        workflow_deleted: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is WebhookEndpointEventType.PARSE_RUN_PROCESSED:
            return parse_run_processed()
        if self is WebhookEndpointEventType.PARSE_RUN_FAILED:
            return parse_run_failed()
        if self is WebhookEndpointEventType.EDIT_RUN_PROCESSED:
            return edit_run_processed()
        if self is WebhookEndpointEventType.EDIT_RUN_FAILED:
            return edit_run_failed()
        if self is WebhookEndpointEventType.EXTRACT_RUN_PROCESSED:
            return extract_run_processed()
        if self is WebhookEndpointEventType.EXTRACT_RUN_FAILED:
            return extract_run_failed()
        if self is WebhookEndpointEventType.CLASSIFY_RUN_PROCESSED:
            return classify_run_processed()
        if self is WebhookEndpointEventType.CLASSIFY_RUN_FAILED:
            return classify_run_failed()
        if self is WebhookEndpointEventType.SPLIT_RUN_PROCESSED:
            return split_run_processed()
        if self is WebhookEndpointEventType.SPLIT_RUN_FAILED:
            return split_run_failed()
        if self is WebhookEndpointEventType.EXTRACTOR_CREATED:
            return extractor_created()
        if self is WebhookEndpointEventType.EXTRACTOR_UPDATED:
            return extractor_updated()
        if self is WebhookEndpointEventType.EXTRACTOR_DELETED:
            return extractor_deleted()
        if self is WebhookEndpointEventType.EXTRACTOR_DRAFT_UPDATED:
            return extractor_draft_updated()
        if self is WebhookEndpointEventType.EXTRACTOR_VERSION_PUBLISHED:
            return extractor_version_published()
        if self is WebhookEndpointEventType.CLASSIFIER_CREATED:
            return classifier_created()
        if self is WebhookEndpointEventType.CLASSIFIER_UPDATED:
            return classifier_updated()
        if self is WebhookEndpointEventType.CLASSIFIER_DELETED:
            return classifier_deleted()
        if self is WebhookEndpointEventType.CLASSIFIER_DRAFT_UPDATED:
            return classifier_draft_updated()
        if self is WebhookEndpointEventType.CLASSIFIER_VERSION_PUBLISHED:
            return classifier_version_published()
        if self is WebhookEndpointEventType.SPLITTER_CREATED:
            return splitter_created()
        if self is WebhookEndpointEventType.SPLITTER_UPDATED:
            return splitter_updated()
        if self is WebhookEndpointEventType.SPLITTER_DELETED:
            return splitter_deleted()
        if self is WebhookEndpointEventType.SPLITTER_DRAFT_UPDATED:
            return splitter_draft_updated()
        if self is WebhookEndpointEventType.SPLITTER_VERSION_PUBLISHED:
            return splitter_version_published()
        if self is WebhookEndpointEventType.WORKFLOW_CREATED:
            return workflow_created()
        if self is WebhookEndpointEventType.WORKFLOW_DEPLOYED:
            return workflow_deployed()
        if self is WebhookEndpointEventType.WORKFLOW_DELETED:
            return workflow_deleted()
        return _unknown_member(self._value_)
