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

from __future__ import annotations

import typing

import typing_extensions
from ..core.serialization import FieldMetadata
from .classifier import ClassifierParams
from .classifier_version import ClassifierVersionParams
from .classify_run import ClassifyRunParams
from .edit_run import EditRunParams
from .extract_run import ExtractRunParams
from .extractor import ExtractorParams
from .extractor_version import ExtractorVersionParams
from .parse_run_status import ParseRunStatusParams
from .split_run import SplitRunParams
from .splitter import SplitterParams
from .splitter_version import SplitterVersionParams
from .step_run import StepRunParams
from .workflow import WorkflowParams
from .workflow_run import WorkflowRunParams


class WebhookEvent_WorkflowRunCompletedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow_run.completed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowRunParams


class WebhookEvent_WorkflowRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowRunParams


class WebhookEvent_WorkflowRunNeedsReviewParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["workflow_run.needs_review"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowRunParams


class WebhookEvent_WorkflowRunRejectedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow_run.rejected"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowRunParams


class WebhookEvent_WorkflowRunCancelledParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow_run.cancelled"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowRunParams


class WebhookEvent_WorkflowRunStepRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["workflow_run.step_run.processed"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: StepRunParams


class WebhookEvent_ExtractRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extract_run.processed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractRunParams


class WebhookEvent_ExtractRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extract_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractRunParams


class WebhookEvent_ClassifyRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["classify_run.processed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifyRunParams


class WebhookEvent_ClassifyRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["classify_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifyRunParams


class WebhookEvent_SplitRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["split_run.processed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitRunParams


class WebhookEvent_SplitRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["split_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitRunParams


class WebhookEvent_ParseRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["parse_run.processed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ParseRunStatusParams


class WebhookEvent_ParseRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["parse_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ParseRunStatusParams


class WebhookEvent_EditRunProcessedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["edit_run.processed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: EditRunParams


class WebhookEvent_EditRunFailedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["edit_run.failed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: EditRunParams


class WebhookEvent_WorkflowCreatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow.created"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowParams


class WebhookEvent_WorkflowDeployedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow.deployed"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowParams


class WebhookEvent_WorkflowDeletedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["workflow.deleted"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: WorkflowParams


class WebhookEvent_ExtractorCreatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extractor.created"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractorParams


class WebhookEvent_ExtractorUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extractor.updated"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractorParams


class WebhookEvent_ExtractorDeletedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extractor.deleted"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractorParams


class WebhookEvent_ExtractorDraftUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["extractor.draft.updated"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractorParams


class WebhookEvent_ExtractorVersionPublishedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["extractor.version.published"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ExtractorVersionParams


class WebhookEvent_ClassifierCreatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["classifier.created"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifierParams


class WebhookEvent_ClassifierUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["classifier.updated"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifierParams


class WebhookEvent_ClassifierDeletedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["classifier.deleted"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifierParams


class WebhookEvent_ClassifierDraftUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["classifier.draft.updated"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifierParams


class WebhookEvent_ClassifierVersionPublishedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["classifier.version.published"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: ClassifierVersionParams


class WebhookEvent_SplitterCreatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["splitter.created"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitterParams


class WebhookEvent_SplitterUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["splitter.updated"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitterParams


class WebhookEvent_SplitterDeletedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["splitter.deleted"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitterParams


class WebhookEvent_SplitterDraftUpdatedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[typing.Literal["splitter.draft.updated"], FieldMetadata(alias="eventType")]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitterParams


class WebhookEvent_SplitterVersionPublishedParams(typing_extensions.TypedDict):
    event_type: typing_extensions.Annotated[
        typing.Literal["splitter.version.published"], FieldMetadata(alias="eventType")
    ]
    event_id: typing_extensions.Annotated[str, FieldMetadata(alias="eventId")]
    payload: SplitterVersionParams


WebhookEventParams = typing.Union[
    WebhookEvent_WorkflowRunCompletedParams,
    WebhookEvent_WorkflowRunFailedParams,
    WebhookEvent_WorkflowRunNeedsReviewParams,
    WebhookEvent_WorkflowRunRejectedParams,
    WebhookEvent_WorkflowRunCancelledParams,
    WebhookEvent_WorkflowRunStepRunProcessedParams,
    WebhookEvent_ExtractRunProcessedParams,
    WebhookEvent_ExtractRunFailedParams,
    WebhookEvent_ClassifyRunProcessedParams,
    WebhookEvent_ClassifyRunFailedParams,
    WebhookEvent_SplitRunProcessedParams,
    WebhookEvent_SplitRunFailedParams,
    WebhookEvent_ParseRunProcessedParams,
    WebhookEvent_ParseRunFailedParams,
    WebhookEvent_EditRunProcessedParams,
    WebhookEvent_EditRunFailedParams,
    WebhookEvent_WorkflowCreatedParams,
    WebhookEvent_WorkflowDeployedParams,
    WebhookEvent_WorkflowDeletedParams,
    WebhookEvent_ExtractorCreatedParams,
    WebhookEvent_ExtractorUpdatedParams,
    WebhookEvent_ExtractorDeletedParams,
    WebhookEvent_ExtractorDraftUpdatedParams,
    WebhookEvent_ExtractorVersionPublishedParams,
    WebhookEvent_ClassifierCreatedParams,
    WebhookEvent_ClassifierUpdatedParams,
    WebhookEvent_ClassifierDeletedParams,
    WebhookEvent_ClassifierDraftUpdatedParams,
    WebhookEvent_ClassifierVersionPublishedParams,
    WebhookEvent_SplitterCreatedParams,
    WebhookEvent_SplitterUpdatedParams,
    WebhookEvent_SplitterDeletedParams,
    WebhookEvent_SplitterDraftUpdatedParams,
    WebhookEvent_SplitterVersionPublishedParams,
]
