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

from __future__ import annotations

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
from .workflow_definition import WorkflowDefinition
from .workflow_proxy_location import WorkflowProxyLocation
from .workflow_status import WorkflowStatus


class Workflow(UniversalBaseModel):
    workflow_id: str
    organization_id: str
    title: str
    workflow_permanent_id: str
    version: int
    is_saved_task: bool
    is_template: typing.Optional[bool] = None
    description: typing.Optional[str] = None
    workflow_definition: WorkflowDefinition
    proxy_location: typing.Optional[WorkflowProxyLocation] = None
    webhook_callback_url: typing.Optional[str] = None
    totp_verification_url: typing.Optional[str] = None
    totp_identifier: typing.Optional[str] = None
    persist_browser_session: typing.Optional[bool] = None
    model: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    status: typing.Optional[WorkflowStatus] = None
    max_screenshot_scrolls: typing.Optional[int] = None
    extra_http_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
    run_with: typing.Optional[str] = None
    ai_fallback: typing.Optional[bool] = None
    cache_key: typing.Optional[str] = None
    run_sequentially: typing.Optional[bool] = None
    sequential_key: typing.Optional[str] = None
    folder_id: typing.Optional[str] = None
    import_error: typing.Optional[str] = None
    created_at: dt.datetime
    modified_at: dt.datetime
    deleted_at: typing.Optional[dt.datetime] = 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


from .context_parameter import ContextParameter  # noqa: E402, F401, I001
from .for_loop_block import ForLoopBlock  # noqa: E402, F401, I001

update_forward_refs(Workflow)
