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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .action import Action
from .block_type import BlockType
from .run_engine import RunEngine
from .workflow_run_block_data_schema import WorkflowRunBlockDataSchema
from .workflow_run_block_navigation_payload import WorkflowRunBlockNavigationPayload
from .workflow_run_block_output import WorkflowRunBlockOutput


class WorkflowRunBlock(UniversalBaseModel):
    workflow_run_block_id: str
    block_workflow_run_id: typing.Optional[str] = None
    workflow_run_id: str
    organization_id: str
    description: typing.Optional[str] = None
    parent_workflow_run_block_id: typing.Optional[str] = None
    block_type: BlockType
    label: typing.Optional[str] = None
    status: typing.Optional[str] = None
    output: typing.Optional[WorkflowRunBlockOutput] = None
    continue_on_failure: typing.Optional[bool] = None
    failure_reason: typing.Optional[str] = None
    engine: typing.Optional[RunEngine] = None
    task_id: typing.Optional[str] = None
    url: typing.Optional[str] = None
    navigation_goal: typing.Optional[str] = None
    navigation_payload: typing.Optional[WorkflowRunBlockNavigationPayload] = None
    data_extraction_goal: typing.Optional[str] = None
    data_schema: typing.Optional[WorkflowRunBlockDataSchema] = None
    terminate_criterion: typing.Optional[str] = None
    complete_criterion: typing.Optional[str] = None
    actions: typing.Optional[typing.List[Action]] = None
    created_at: dt.datetime
    modified_at: dt.datetime
    include_action_history_in_verification: typing.Optional[bool] = None
    duration: typing.Optional[float] = None
    loop_values: typing.Optional[typing.List[typing.Optional[typing.Any]]] = None
    current_value: typing.Optional[str] = None
    current_index: typing.Optional[int] = None
    recipients: typing.Optional[typing.List[str]] = None
    attachments: typing.Optional[typing.List[str]] = None
    subject: typing.Optional[str] = None
    body: typing.Optional[str] = None
    instructions: typing.Optional[str] = None
    positive_descriptor: typing.Optional[str] = None
    negative_descriptor: typing.Optional[str] = None
    executed_branch_id: typing.Optional[str] = None
    executed_branch_expression: typing.Optional[str] = None
    executed_branch_result: typing.Optional[bool] = None
    executed_branch_next_block: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
