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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class WorkflowResponse(UniversalBaseModel):
    """
    Schema for workflow response.
    """

    id: str = pydantic.Field()
    """
    Workflow ID (flow_ prefixed)
    """

    organization_id: str = pydantic.Field()
    """
    Organization ID
    """

    name: str = pydantic.Field()
    """
    Workflow name
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Workflow description
    """

    definition: typing.Dict[str, typing.Any] = pydantic.Field()
    """
    Flow-plate workflow JSON
    """

    version: int = pydantic.Field()
    """
    Workflow version number
    """

    is_active: bool = pydantic.Field()
    """
    Whether workflow is active
    """

    created_at: int = pydantic.Field()
    """
    Creation timestamp (Unix)
    """

    updated_at: int = pydantic.Field()
    """
    Update timestamp (Unix)
    """

    created_by: typing.Optional[str] = pydantic.Field(default=None)
    """
    Creator user ID
    """

    external_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Flow-plate flow ID
    """

    assistant_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Linked assistant ID
    """

    has_assistant: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether workflow has Assistant node
    """

    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
