# 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 .script_run_response import ScriptRunResponse
from .workflow_run_proxy_location import WorkflowRunProxyLocation
from .workflow_run_status import WorkflowRunStatus


class WorkflowRun(UniversalBaseModel):
    workflow_run_id: str
    workflow_id: str
    workflow_permanent_id: str
    organization_id: str
    browser_session_id: typing.Optional[str] = None
    browser_profile_id: typing.Optional[str] = None
    debug_session_id: typing.Optional[str] = None
    status: WorkflowRunStatus
    extra_http_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
    proxy_location: typing.Optional[WorkflowRunProxyLocation] = None
    webhook_callback_url: typing.Optional[str] = None
    webhook_failure_reason: typing.Optional[str] = None
    totp_verification_url: typing.Optional[str] = None
    totp_identifier: typing.Optional[str] = None
    failure_reason: typing.Optional[str] = None
    parent_workflow_run_id: typing.Optional[str] = None
    workflow_title: typing.Optional[str] = None
    max_screenshot_scrolls: typing.Optional[int] = None
    browser_address: typing.Optional[str] = None
    run_with: typing.Optional[str] = None
    script_run: typing.Optional[ScriptRunResponse] = None
    job_id: typing.Optional[str] = None
    depends_on_workflow_run_id: typing.Optional[str] = None
    sequential_key: typing.Optional[str] = None
    ai_fallback: typing.Optional[bool] = None
    code_gen: typing.Optional[bool] = None
    waiting_for_verification_code: typing.Optional[bool] = None
    verification_code_identifier: typing.Optional[str] = None
    verification_code_polling_started_at: typing.Optional[dt.datetime] = None
    queued_at: typing.Optional[dt.datetime] = None
    started_at: typing.Optional[dt.datetime] = None
    finished_at: typing.Optional[dt.datetime] = None
    created_at: dt.datetime
    modified_at: dt.datetime

    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
