"""
This file is auto generated. Do not edit this file manually.
Source code: [monorepo]/contracts/generator.py
"""

import datetime
import typing
from dataclasses import dataclass, field

CommonFileNodePathPartsItem = str

CommonFileNodePathParts = typing.List[CommonFileNodePathPartsItem]

CommonFileNodeSize = int

CommonFileNodeLastModified = datetime.datetime

CommonFileNodeType = typing.Union[
    typing.Literal["file"],
    typing.Literal["directory"],
    typing.Literal["module"],
    typing.Literal["package"],
]

CommonFileNodeTypeValues: typing.List[CommonFileNodeType] = [
    "file",
    "directory",
    "module",
    "package",
]

CommonFileNodeChildrenItemItem = str

CommonFileNodeChildrenItem = typing.List[CommonFileNodeChildrenItemItem]

CommonFileNodeChildren = typing.List[CommonFileNodeChildrenItem]


@dataclass
class CommonFileNode:
    path_parts: CommonFileNodePathParts
    size: CommonFileNodeSize
    last_modified: CommonFileNodeLastModified
    type: CommonFileNodeType
    children: typing.Optional[CommonFileNodeChildren] = field(
        default_factory=lambda: []
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["pathParts"] = self.path_parts
        data["size"] = self.size
        data["lastModified"] = self.last_modified.isoformat()
        data["type"] = self.type
        if self.children is not None:
            data["children"] = [item for item in self.children]
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonFileNode":
        return cls(
            path_parts=[str(item) for item in data["pathParts"]],
            size=int(data["size"]),
            last_modified=datetime.datetime.fromisoformat(data["lastModified"]),
            type=data["type"],
            children=None
            if data.get("children") is None
            else [[str(item) for item in item] for item in data["children"]],
        )


CommonPartialFeatureFlagsPROJECTLIVE = bool

CommonPartialFeatureFlagsALLOWRELEASE = bool

CommonPartialFeatureFlagsCONNECTORSCONSOLE = bool

CommonPartialFeatureFlagsDUPLICATEPROJECTS = bool

CommonPartialFeatureFlagsWEBEDITOR = bool

CommonPartialFeatureFlagsLANGCHAINSMARTCHAT = bool

CommonPartialFeatureFlagsENABLESERVERGEVENT = bool

CommonPartialFeatureFlagsENABLEWORKERPODS = bool

CommonPartialFeatureFlagsCOMPONENTSTAGE = bool

CommonPartialFeatureFlagsWHITELISTIPSENABLED = bool

CommonPartialFeatureFlagsGEMINI = bool

CommonPartialFeatureFlagsAGENTS = bool

CommonPartialFeatureFlagsCENTRALSCHEDULER = bool

CommonPartialFeatureFlagsKATAFIRECRACKER = bool

CommonPartialFeatureFlagsCLOUDWORKEREXECUTIONS = bool

CommonPartialFeatureFlagsUSEKIMI = bool

CommonPartialFeatureFlagsPAGES = bool


@dataclass
class CommonPartialFeatureFlags:
    p_r_o_j_e_c_t_l_i_v_e: typing.Optional[CommonPartialFeatureFlagsPROJECTLIVE] = (
        field(default_factory=lambda: None)
    )
    a_l_l_o_w_r_e_l_e_a_s_e: typing.Optional[CommonPartialFeatureFlagsALLOWRELEASE] = (
        field(default_factory=lambda: None)
    )
    c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e: typing.Optional[
        CommonPartialFeatureFlagsCONNECTORSCONSOLE
    ] = field(default_factory=lambda: None)
    d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s: typing.Optional[
        CommonPartialFeatureFlagsDUPLICATEPROJECTS
    ] = field(default_factory=lambda: None)
    w_e_b_e_d_i_t_o_r: typing.Optional[CommonPartialFeatureFlagsWEBEDITOR] = field(
        default_factory=lambda: None
    )
    l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t: typing.Optional[
        CommonPartialFeatureFlagsLANGCHAINSMARTCHAT
    ] = field(default_factory=lambda: None)
    e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t: typing.Optional[
        CommonPartialFeatureFlagsENABLESERVERGEVENT
    ] = field(default_factory=lambda: None)
    e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s: typing.Optional[
        CommonPartialFeatureFlagsENABLEWORKERPODS
    ] = field(default_factory=lambda: None)
    c_o_m_p_o_n_e_n_t_s_t_a_g_e: typing.Optional[
        CommonPartialFeatureFlagsCOMPONENTSTAGE
    ] = field(default_factory=lambda: None)
    w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d: typing.Optional[
        CommonPartialFeatureFlagsWHITELISTIPSENABLED
    ] = field(default_factory=lambda: None)
    g_e_m_i_n_i: typing.Optional[CommonPartialFeatureFlagsGEMINI] = field(
        default_factory=lambda: None
    )
    a_g_e_n_t_s: typing.Optional[CommonPartialFeatureFlagsAGENTS] = field(
        default_factory=lambda: None
    )
    c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r: typing.Optional[
        CommonPartialFeatureFlagsCENTRALSCHEDULER
    ] = field(default_factory=lambda: None)
    k_a_t_a_f_i_r_e_c_r_a_c_k_e_r: typing.Optional[
        CommonPartialFeatureFlagsKATAFIRECRACKER
    ] = field(default_factory=lambda: None)
    c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s: typing.Optional[
        CommonPartialFeatureFlagsCLOUDWORKEREXECUTIONS
    ] = field(default_factory=lambda: None)
    u_s_e_k_i_m_i: typing.Optional[CommonPartialFeatureFlagsUSEKIMI] = field(
        default_factory=lambda: None
    )
    p_a_g_e_s: typing.Optional[CommonPartialFeatureFlagsPAGES] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.p_r_o_j_e_c_t_l_i_v_e is not None:
            data["PROJECT_LIVE"] = self.p_r_o_j_e_c_t_l_i_v_e
        if self.a_l_l_o_w_r_e_l_e_a_s_e is not None:
            data["ALLOW_RELEASE"] = self.a_l_l_o_w_r_e_l_e_a_s_e
        if self.c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e is not None:
            data["CONNECTORS_CONSOLE"] = self.c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e
        if self.d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s is not None:
            data["DUPLICATE_PROJECTS"] = self.d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s
        if self.w_e_b_e_d_i_t_o_r is not None:
            data["WEB_EDITOR"] = self.w_e_b_e_d_i_t_o_r
        if self.l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t is not None:
            data["LANGCHAIN_SMART_CHAT"] = self.l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t
        if self.e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t is not None:
            data["ENABLE_SERVER_GEVENT"] = self.e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t
        if self.e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s is not None:
            data["ENABLE_WORKER_PODS"] = self.e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s
        if self.c_o_m_p_o_n_e_n_t_s_t_a_g_e is not None:
            data["COMPONENT_STAGE"] = self.c_o_m_p_o_n_e_n_t_s_t_a_g_e
        if self.w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d is not None:
            data["WHITELIST_IPS_ENABLED"] = self.w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d
        if self.g_e_m_i_n_i is not None:
            data["GEMINI"] = self.g_e_m_i_n_i
        if self.a_g_e_n_t_s is not None:
            data["AGENTS"] = self.a_g_e_n_t_s
        if self.c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r is not None:
            data["CENTRAL_SCHEDULER"] = self.c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r
        if self.k_a_t_a_f_i_r_e_c_r_a_c_k_e_r is not None:
            data["KATA_FIRECRACKER"] = self.k_a_t_a_f_i_r_e_c_r_a_c_k_e_r
        if self.c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s is not None:
            data["CLOUD_WORKER_EXECUTIONS"] = (
                self.c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s
            )
        if self.u_s_e_k_i_m_i is not None:
            data["USE_KIMI"] = self.u_s_e_k_i_m_i
        if self.p_a_g_e_s is not None:
            data["PAGES"] = self.p_a_g_e_s
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonPartialFeatureFlags":
        return cls(
            p_r_o_j_e_c_t_l_i_v_e=None
            if data.get("PROJECT_LIVE") is None
            else bool(data["PROJECT_LIVE"]),
            a_l_l_o_w_r_e_l_e_a_s_e=None
            if data.get("ALLOW_RELEASE") is None
            else bool(data["ALLOW_RELEASE"]),
            c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e=None
            if data.get("CONNECTORS_CONSOLE") is None
            else bool(data["CONNECTORS_CONSOLE"]),
            d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s=None
            if data.get("DUPLICATE_PROJECTS") is None
            else bool(data["DUPLICATE_PROJECTS"]),
            w_e_b_e_d_i_t_o_r=None
            if data.get("WEB_EDITOR") is None
            else bool(data["WEB_EDITOR"]),
            l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t=None
            if data.get("LANGCHAIN_SMART_CHAT") is None
            else bool(data["LANGCHAIN_SMART_CHAT"]),
            e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t=None
            if data.get("ENABLE_SERVER_GEVENT") is None
            else bool(data["ENABLE_SERVER_GEVENT"]),
            e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s=None
            if data.get("ENABLE_WORKER_PODS") is None
            else bool(data["ENABLE_WORKER_PODS"]),
            c_o_m_p_o_n_e_n_t_s_t_a_g_e=None
            if data.get("COMPONENT_STAGE") is None
            else bool(data["COMPONENT_STAGE"]),
            w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d=None
            if data.get("WHITELIST_IPS_ENABLED") is None
            else bool(data["WHITELIST_IPS_ENABLED"]),
            g_e_m_i_n_i=None if data.get("GEMINI") is None else bool(data["GEMINI"]),
            a_g_e_n_t_s=None if data.get("AGENTS") is None else bool(data["AGENTS"]),
            c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r=None
            if data.get("CENTRAL_SCHEDULER") is None
            else bool(data["CENTRAL_SCHEDULER"]),
            k_a_t_a_f_i_r_e_c_r_a_c_k_e_r=None
            if data.get("KATA_FIRECRACKER") is None
            else bool(data["KATA_FIRECRACKER"]),
            c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s=None
            if data.get("CLOUD_WORKER_EXECUTIONS") is None
            else bool(data["CLOUD_WORKER_EXECUTIONS"]),
            u_s_e_k_i_m_i=None
            if data.get("USE_KIMI") is None
            else bool(data["USE_KIMI"]),
            p_a_g_e_s=None if data.get("PAGES") is None else bool(data["PAGES"]),
        )


CommonPartialBillingMetadataPlan = str

CommonPartialBillingMetadataFinanceCustomerId = str

CommonPartialBillingMetadataExpires = str

CommonPartialBillingMetadataMessage = str

CommonPartialBillingMetadataMessageLink = str

CommonPartialBillingMetadataMessageCTA = str


@dataclass
class CommonPartialBillingMetadata:
    plan: typing.Optional[CommonPartialBillingMetadataPlan] = field(
        default_factory=lambda: None
    )
    finance_customer_id: typing.Optional[
        CommonPartialBillingMetadataFinanceCustomerId
    ] = field(default_factory=lambda: None)
    expires: typing.Optional[CommonPartialBillingMetadataExpires] = field(
        default_factory=lambda: None
    )
    message: typing.Optional[CommonPartialBillingMetadataMessage] = field(
        default_factory=lambda: None
    )
    message_link: typing.Optional[CommonPartialBillingMetadataMessageLink] = field(
        default_factory=lambda: None
    )
    message_c_t_a: typing.Optional[CommonPartialBillingMetadataMessageCTA] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.plan is not None:
            data["plan"] = self.plan
        if self.finance_customer_id is not None:
            data["financeCustomerId"] = self.finance_customer_id
        if self.expires is not None:
            data["expires"] = self.expires
        if self.message is not None:
            data["message"] = self.message
        if self.message_link is not None:
            data["messageLink"] = self.message_link
        if self.message_c_t_a is not None:
            data["messageCTA"] = self.message_c_t_a
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonPartialBillingMetadata":
        return cls(
            plan=None if data.get("plan") is None else str(data["plan"]),
            finance_customer_id=None
            if data.get("financeCustomerId") is None
            else str(data["financeCustomerId"]),
            expires=None if data.get("expires") is None else str(data["expires"]),
            message=None if data.get("message") is None else str(data["message"]),
            message_link=None
            if data.get("messageLink") is None
            else str(data["messageLink"]),
            message_c_t_a=None
            if data.get("messageCTA") is None
            else str(data["messageCTA"]),
        )


CommonRoleId = str

CommonRoleName = str

CommonRoleDescription = str

CommonRoleProjectId = str

CommonRoleCreatedAt = str


@dataclass
class CommonRole:
    id: CommonRoleId
    name: CommonRoleName
    project_id: CommonRoleProjectId
    created_at: CommonRoleCreatedAt
    description: typing.Optional[CommonRoleDescription] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["name"] = self.name
        data["projectId"] = self.project_id
        data["createdAt"] = self.created_at
        if self.description is not None:
            data["description"] = self.description
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonRole":
        return cls(
            id=str(data["id"]),
            name=str(data["name"]),
            project_id=str(data["projectId"]),
            created_at=str(data["createdAt"]),
            description=None
            if data.get("description") is None
            else str(data["description"]),
        )


CommonProjectId = str

CommonProjectFolderId = str

CommonProjectName = str

CommonProjectSubdomain = str

CommonProjectOrganizationId = str

CommonProjectDeploymentResourcesWatermarkEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonProjectDeploymentResourcesWatermarkEnabledValues: typing.List[
    CommonProjectDeploymentResourcesWatermarkEnabled
] = ["true", "false"]

CommonProjectDeploymentResourcesSeleniumInstanceEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonProjectDeploymentResourcesSeleniumInstanceEnabledValues: typing.List[
    CommonProjectDeploymentResourcesSeleniumInstanceEnabled
] = ["true", "false"]

CommonProjectDeploymentResourcesUseCloudApiPlayer = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonProjectDeploymentResourcesUseCloudApiPlayerValues: typing.List[
    CommonProjectDeploymentResourcesUseCloudApiPlayer
] = ["true", "false"]

CommonProjectDeploymentResourcesNotificationsEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonProjectDeploymentResourcesNotificationsEnabledValues: typing.List[
    CommonProjectDeploymentResourcesNotificationsEnabled
] = ["true", "false"]

CommonProjectDeploymentResourcesRequestsCPU = str

CommonProjectDeploymentResourcesLimitsCPU = str

CommonProjectDeploymentResourcesRequestsMemory = str

CommonProjectDeploymentResourcesLimitsMemory = str

CommonProjectDeploymentResourcesMinReplicas = str

CommonProjectDeploymentResourcesComputeUnits = float

CommonProjectDeploymentResourcesServerComputeUnits = float

CommonProjectDeploymentResourcesTimeoutSeconds = str

CommonProjectDeploymentResourcesWorkerType = str

CommonProjectDeploymentResourcesPythonVersion = typing.Union[
    typing.Literal["3.9"],
    typing.Literal["3.10"],
    typing.Literal["3.11"],
    typing.Literal["3.12"],
]

CommonProjectDeploymentResourcesPythonVersionValues: typing.List[
    CommonProjectDeploymentResourcesPythonVersion
] = ["3.9", "3.10", "3.11", "3.12"]

CommonProjectDeploymentResourcesWorkerNumber = str

CommonProjectDeploymentResourcesBaseDockerfile = str

CommonProjectDeploymentResourcesQueueMessagesPerWorker = str

CommonProjectDeploymentResourcesAutoscaleMinWorker = str

CommonProjectDeploymentResourcesAutoscaleMaxWorker = str

CommonProjectDeploymentResourcesWhitelistIpsItem = str

CommonProjectDeploymentResourcesWhitelistIps = typing.List[
    CommonProjectDeploymentResourcesWhitelistIpsItem
]

CommonProjectDeploymentResourcesExecutorPoolSize = str

CommonProjectDeploymentResourcesMinFormsExecutors = str

CommonProjectDeploymentResourcesExecutorMaxExecutions = str

CommonProjectDeploymentResourcesExecutorWarmupParallelism = str


@dataclass
class CommonProjectDeploymentResources:
    watermark_enabled: typing.Optional[
        CommonProjectDeploymentResourcesWatermarkEnabled
    ] = field(default_factory=lambda: None)
    selenium_instance_enabled: typing.Optional[
        CommonProjectDeploymentResourcesSeleniumInstanceEnabled
    ] = field(default_factory=lambda: None)
    use_cloud_api_player: typing.Optional[
        CommonProjectDeploymentResourcesUseCloudApiPlayer
    ] = field(default_factory=lambda: None)
    notifications_enabled: typing.Optional[
        CommonProjectDeploymentResourcesNotificationsEnabled
    ] = field(default_factory=lambda: None)
    requests_c_p_u: typing.Optional[CommonProjectDeploymentResourcesRequestsCPU] = (
        field(default_factory=lambda: None)
    )
    limits_c_p_u: typing.Optional[CommonProjectDeploymentResourcesLimitsCPU] = field(
        default_factory=lambda: None
    )
    requests_memory: typing.Optional[CommonProjectDeploymentResourcesRequestsMemory] = (
        field(default_factory=lambda: None)
    )
    limits_memory: typing.Optional[CommonProjectDeploymentResourcesLimitsMemory] = (
        field(default_factory=lambda: None)
    )
    min_replicas: typing.Optional[CommonProjectDeploymentResourcesMinReplicas] = field(
        default_factory=lambda: None
    )
    compute_units: typing.Optional[CommonProjectDeploymentResourcesComputeUnits] = (
        field(default_factory=lambda: None)
    )
    server_compute_units: typing.Optional[
        CommonProjectDeploymentResourcesServerComputeUnits
    ] = field(default_factory=lambda: None)
    timeout_seconds: typing.Optional[CommonProjectDeploymentResourcesTimeoutSeconds] = (
        field(default_factory=lambda: None)
    )
    worker_type: typing.Optional[CommonProjectDeploymentResourcesWorkerType] = field(
        default_factory=lambda: None
    )
    python_version: typing.Optional[CommonProjectDeploymentResourcesPythonVersion] = (
        field(default_factory=lambda: None)
    )
    worker_number: typing.Optional[CommonProjectDeploymentResourcesWorkerNumber] = (
        field(default_factory=lambda: None)
    )
    base_dockerfile: typing.Optional[CommonProjectDeploymentResourcesBaseDockerfile] = (
        field(default_factory=lambda: None)
    )
    queue_messages_per_worker: typing.Optional[
        CommonProjectDeploymentResourcesQueueMessagesPerWorker
    ] = field(default_factory=lambda: None)
    autoscale_min_worker: typing.Optional[
        CommonProjectDeploymentResourcesAutoscaleMinWorker
    ] = field(default_factory=lambda: None)
    autoscale_max_worker: typing.Optional[
        CommonProjectDeploymentResourcesAutoscaleMaxWorker
    ] = field(default_factory=lambda: None)
    whitelist_ips: typing.Optional[CommonProjectDeploymentResourcesWhitelistIps] = (
        field(default_factory=lambda: None)
    )
    executor_pool_size: typing.Optional[
        CommonProjectDeploymentResourcesExecutorPoolSize
    ] = field(default_factory=lambda: None)
    min_forms_executors: typing.Optional[
        CommonProjectDeploymentResourcesMinFormsExecutors
    ] = field(default_factory=lambda: None)
    executor_max_executions: typing.Optional[
        CommonProjectDeploymentResourcesExecutorMaxExecutions
    ] = field(default_factory=lambda: None)
    executor_warmup_parallelism: typing.Optional[
        CommonProjectDeploymentResourcesExecutorWarmupParallelism
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.watermark_enabled is not None:
            data["watermarkEnabled"] = self.watermark_enabled
        if self.selenium_instance_enabled is not None:
            data["seleniumInstanceEnabled"] = self.selenium_instance_enabled
        if self.use_cloud_api_player is not None:
            data["useCloudApiPlayer"] = self.use_cloud_api_player
        if self.notifications_enabled is not None:
            data["notificationsEnabled"] = self.notifications_enabled
        if self.requests_c_p_u is not None:
            data["requestsCPU"] = self.requests_c_p_u
        if self.limits_c_p_u is not None:
            data["limitsCPU"] = self.limits_c_p_u
        if self.requests_memory is not None:
            data["requestsMemory"] = self.requests_memory
        if self.limits_memory is not None:
            data["limitsMemory"] = self.limits_memory
        if self.min_replicas is not None:
            data["minReplicas"] = self.min_replicas
        if self.compute_units is not None:
            data["computeUnits"] = self.compute_units
        if self.server_compute_units is not None:
            data["serverComputeUnits"] = self.server_compute_units
        if self.timeout_seconds is not None:
            data["timeoutSeconds"] = self.timeout_seconds
        if self.worker_type is not None:
            data["workerType"] = self.worker_type
        if self.python_version is not None:
            data["pythonVersion"] = self.python_version
        if self.worker_number is not None:
            data["workerNumber"] = self.worker_number
        if self.base_dockerfile is not None:
            data["baseDockerfile"] = self.base_dockerfile
        if self.queue_messages_per_worker is not None:
            data["queueMessagesPerWorker"] = self.queue_messages_per_worker
        if self.autoscale_min_worker is not None:
            data["autoscaleMinWorker"] = self.autoscale_min_worker
        if self.autoscale_max_worker is not None:
            data["autoscaleMaxWorker"] = self.autoscale_max_worker
        if self.whitelist_ips is not None:
            data["whitelistIps"] = self.whitelist_ips
        if self.executor_pool_size is not None:
            data["executorPoolSize"] = self.executor_pool_size
        if self.min_forms_executors is not None:
            data["minFormsExecutors"] = self.min_forms_executors
        if self.executor_max_executions is not None:
            data["executorMaxExecutions"] = self.executor_max_executions
        if self.executor_warmup_parallelism is not None:
            data["executorWarmupParallelism"] = self.executor_warmup_parallelism
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonProjectDeploymentResources":
        return cls(
            watermark_enabled=None
            if data.get("watermarkEnabled") is None
            else data["watermarkEnabled"],
            selenium_instance_enabled=None
            if data.get("seleniumInstanceEnabled") is None
            else data["seleniumInstanceEnabled"],
            use_cloud_api_player=None
            if data.get("useCloudApiPlayer") is None
            else data["useCloudApiPlayer"],
            notifications_enabled=None
            if data.get("notificationsEnabled") is None
            else data["notificationsEnabled"],
            requests_c_p_u=None
            if data.get("requestsCPU") is None
            else str(data["requestsCPU"]),
            limits_c_p_u=None
            if data.get("limitsCPU") is None
            else str(data["limitsCPU"]),
            requests_memory=None
            if data.get("requestsMemory") is None
            else str(data["requestsMemory"]),
            limits_memory=None
            if data.get("limitsMemory") is None
            else str(data["limitsMemory"]),
            min_replicas=None
            if data.get("minReplicas") is None
            else str(data["minReplicas"]),
            compute_units=None
            if data.get("computeUnits") is None
            else float(data["computeUnits"]),
            server_compute_units=None
            if data.get("serverComputeUnits") is None
            else float(data["serverComputeUnits"]),
            timeout_seconds=None
            if data.get("timeoutSeconds") is None
            else str(data["timeoutSeconds"]),
            worker_type=None
            if data.get("workerType") is None
            else str(data["workerType"]),
            python_version=None
            if data.get("pythonVersion") is None
            else data["pythonVersion"],
            worker_number=None
            if data.get("workerNumber") is None
            else str(data["workerNumber"]),
            base_dockerfile=None
            if data.get("baseDockerfile") is None
            else str(data["baseDockerfile"]),
            queue_messages_per_worker=None
            if data.get("queueMessagesPerWorker") is None
            else str(data["queueMessagesPerWorker"]),
            autoscale_min_worker=None
            if data.get("autoscaleMinWorker") is None
            else str(data["autoscaleMinWorker"]),
            autoscale_max_worker=None
            if data.get("autoscaleMaxWorker") is None
            else str(data["autoscaleMaxWorker"]),
            whitelist_ips=None
            if data.get("whitelistIps") is None
            else [str(item) for item in data["whitelistIps"]],
            executor_pool_size=None
            if data.get("executorPoolSize") is None
            else str(data["executorPoolSize"]),
            min_forms_executors=None
            if data.get("minFormsExecutors") is None
            else str(data["minFormsExecutors"]),
            executor_max_executions=None
            if data.get("executorMaxExecutions") is None
            else str(data["executorMaxExecutions"]),
            executor_warmup_parallelism=None
            if data.get("executorWarmupParallelism") is None
            else str(data["executorWarmupParallelism"]),
        )


@dataclass
class CommonProject:
    id: CommonProjectId
    folder_id: CommonProjectFolderId
    name: CommonProjectName
    subdomain: CommonProjectSubdomain
    organization_id: CommonProjectOrganizationId
    deployment_resources: typing.Optional[CommonProjectDeploymentResources] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["folderId"] = self.folder_id
        data["name"] = self.name
        data["subdomain"] = self.subdomain
        data["organizationId"] = self.organization_id
        if self.deployment_resources is not None:
            data["deploymentResources"] = self.deployment_resources.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonProject":
        return cls(
            id=str(data["id"]),
            folder_id=str(data["folderId"]),
            name=str(data["name"]),
            subdomain=str(data["subdomain"]),
            organization_id=str(data["organizationId"]),
            deployment_resources=None
            if data.get("deploymentResources") is None
            else CommonProjectDeploymentResources.from_dict(
                data["deploymentResources"]
            ),
        )


CommonConnectionName = str

CommonConnectionConnectionType = str

CommonConnectionProjectId = str


@dataclass
class CommonConnection:
    name: CommonConnectionName
    connection_type: CommonConnectionConnectionType
    project_id: CommonConnectionProjectId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["connectionType"] = self.connection_type
        data["projectId"] = self.project_id
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonConnection":
        return cls(
            name=str(data["name"]),
            connection_type=str(data["connectionType"]),
            project_id=str(data["projectId"]),
        )


CommonSignupPolicyId = str

CommonSignupPolicyEmailPatternsItem = str

CommonSignupPolicyEmailPatterns = typing.List[CommonSignupPolicyEmailPatternsItem]

CommonSignupPolicyProjectId = str

CommonSignupPolicyCreatedAt = str


@dataclass
class CommonSignupPolicy:
    id: CommonSignupPolicyId
    email_patterns: CommonSignupPolicyEmailPatterns
    project_id: CommonSignupPolicyProjectId
    created_at: CommonSignupPolicyCreatedAt

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["emailPatterns"] = self.email_patterns
        data["projectId"] = self.project_id
        data["createdAt"] = self.created_at
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonSignupPolicy":
        return cls(
            id=str(data["id"]),
            email_patterns=[str(item) for item in data["emailPatterns"]],
            project_id=str(data["projectId"]),
            created_at=str(data["createdAt"]),
        )


CommonConnectorMetadataKey = str

CommonConnectorMetadataLabel = str

CommonConnectorMetadataDescription = str

CommonConnectorMetadataLogoUrl = str

CommonConnectorMetadataTag = str

CommonConnectorMetadataBeta = bool

CommonConnectorMetadataPostConnectionSetupItemType = str

CommonConnectorMetadataPostConnectionSetupItemTitle = str


@dataclass
class CommonConnectorMetadataPostConnectionSetupItem:
    type: CommonConnectorMetadataPostConnectionSetupItemType
    title: CommonConnectorMetadataPostConnectionSetupItemTitle

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["title"] = self.title
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorMetadataPostConnectionSetupItem":
        return cls(
            type=str(data["type"]),
            title=str(data["title"]),
        )


CommonConnectorMetadataPostConnectionSetup = typing.List[
    CommonConnectorMetadataPostConnectionSetupItem
]


@dataclass
class CommonConnectorMetadata:
    key: CommonConnectorMetadataKey
    label: CommonConnectorMetadataLabel
    description: CommonConnectorMetadataDescription
    logo_url: CommonConnectorMetadataLogoUrl
    tag: typing.Optional[CommonConnectorMetadataTag] = field(
        default_factory=lambda: None
    )
    beta: typing.Optional[CommonConnectorMetadataBeta] = field(
        default_factory=lambda: None
    )
    post_connection_setup: typing.Optional[
        CommonConnectorMetadataPostConnectionSetup
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["label"] = self.label
        data["description"] = self.description
        data["logoUrl"] = self.logo_url
        if self.tag is not None:
            data["tag"] = self.tag
        if self.beta is not None:
            data["beta"] = self.beta
        if self.post_connection_setup is not None:
            data["postConnectionSetup"] = [
                item.to_dict() for item in self.post_connection_setup
            ]
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonConnectorMetadata":
        return cls(
            key=str(data["key"]),
            label=str(data["label"]),
            description=str(data["description"]),
            logo_url=str(data["logoUrl"]),
            tag=None if data.get("tag") is None else str(data["tag"]),
            beta=None if data.get("beta") is None else bool(data["beta"]),
            post_connection_setup=None
            if data.get("postConnectionSetup") is None
            else [
                CommonConnectorMetadataPostConnectionSetupItem.from_dict(item)
                for item in data["postConnectionSetup"]
            ],
        )


CommonConnectorAuthTokenBasedConnectorAuthType = typing.Literal["tokens"]

CommonConnectorAuthTokenBasedConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthTokenBasedConnectorAuthType
] = ["tokens"]

CommonConnectorDefinitionsInputParametersItemKey = str

CommonConnectorDefinitionsInputParametersItemLabel = str

CommonConnectorDefinitionsInputParametersItemDescription = str

CommonConnectorDefinitionsInputParametersItemConditionAdditionalPropertyEquals = str


@dataclass
class CommonConnectorDefinitionsInputParametersItemConditionAdditionalProperty:
    equals: (
        CommonConnectorDefinitionsInputParametersItemConditionAdditionalPropertyEquals
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["equals"] = self.equals
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorDefinitionsInputParametersItemConditionAdditionalProperty":
        return cls(
            equals=str(data["equals"]),
        )


CommonConnectorDefinitionsInputParametersItemCondition = typing.Dict[
    str, CommonConnectorDefinitionsInputParametersItemConditionAdditionalProperty
]

CommonConnectorDefinitionsInputParametersItemInstructions = str

CommonConnectorDefinitionsInputParametersItemInputType = typing.Union[
    typing.Literal["small-string"],
    typing.Literal["large-text"],
    typing.Literal["file"],
    typing.Literal["radiobox"],
    typing.Literal["checkbox"],
]

CommonConnectorDefinitionsInputParametersItemInputTypeValues: typing.List[
    CommonConnectorDefinitionsInputParametersItemInputType
] = ["small-string", "large-text", "file", "radiobox", "checkbox"]

CommonConnectorDefinitionsInputParametersItemInputOptionsItemValue = str

CommonConnectorDefinitionsInputParametersItemInputOptionsItemLabel = str


@dataclass
class CommonConnectorDefinitionsInputParametersItemInputOptionsItem:
    value: CommonConnectorDefinitionsInputParametersItemInputOptionsItemValue
    label: CommonConnectorDefinitionsInputParametersItemInputOptionsItemLabel

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["value"] = self.value
        data["label"] = self.label
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorDefinitionsInputParametersItemInputOptionsItem":
        return cls(
            value=str(data["value"]),
            label=str(data["label"]),
        )


CommonConnectorDefinitionsInputParametersItemInputOptions = typing.List[
    CommonConnectorDefinitionsInputParametersItemInputOptionsItem
]

CommonConnectorDefinitionsInputParametersItemInputMaxSize = int

CommonConnectorDefinitionsInputParametersItemInputMinSize = int


@dataclass
class CommonConnectorDefinitionsInputParametersItemInput:
    type: CommonConnectorDefinitionsInputParametersItemInputType
    options: typing.Optional[
        CommonConnectorDefinitionsInputParametersItemInputOptions
    ] = field(default_factory=lambda: None)
    max_size: typing.Optional[
        CommonConnectorDefinitionsInputParametersItemInputMaxSize
    ] = field(default_factory=lambda: None)
    min_size: typing.Optional[
        CommonConnectorDefinitionsInputParametersItemInputMinSize
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        if self.options is not None:
            data["options"] = [item.to_dict() for item in self.options]
        if self.max_size is not None:
            data["maxSize"] = self.max_size
        if self.min_size is not None:
            data["minSize"] = self.min_size
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorDefinitionsInputParametersItemInput":
        return cls(
            type=data["type"],
            options=None
            if data.get("options") is None
            else [
                CommonConnectorDefinitionsInputParametersItemInputOptionsItem.from_dict(
                    item
                )
                for item in data["options"]
            ],
            max_size=None if data.get("maxSize") is None else int(data["maxSize"]),
            min_size=None if data.get("minSize") is None else int(data["minSize"]),
        )


@dataclass
class CommonConnectorDefinitionsInputParametersItem:
    key: CommonConnectorDefinitionsInputParametersItemKey
    label: CommonConnectorDefinitionsInputParametersItemLabel
    description: CommonConnectorDefinitionsInputParametersItemDescription
    input: CommonConnectorDefinitionsInputParametersItemInput
    condition: typing.Optional[
        CommonConnectorDefinitionsInputParametersItemCondition
    ] = field(default_factory=lambda: None)
    instructions: typing.Optional[
        CommonConnectorDefinitionsInputParametersItemInstructions
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["label"] = self.label
        data["description"] = self.description
        data["input"] = self.input.to_dict()
        if self.condition is not None:
            data["condition"] = self.condition
        if self.instructions is not None:
            data["instructions"] = self.instructions
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorDefinitionsInputParametersItem":
        return cls(
            key=str(data["key"]),
            label=str(data["label"]),
            description=str(data["description"]),
            input=CommonConnectorDefinitionsInputParametersItemInput.from_dict(
                data["input"]
            ),
            condition=None
            if data.get("condition") is None
            else dict(**data["condition"]),
            instructions=None
            if data.get("instructions") is None
            else str(data["instructions"]),
        )


CommonConnectorDefinitionsInputParameters = typing.List[
    CommonConnectorDefinitionsInputParametersItem
]

CommonConnectorAuthTokenBasedConnectorAuthTokens = (
    CommonConnectorDefinitionsInputParameters
)


@dataclass
class CommonConnectorAuthTokenBasedConnectorAuth:
    type: CommonConnectorAuthTokenBasedConnectorAuthType
    tokens: CommonConnectorAuthTokenBasedConnectorAuthTokens

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["tokens"] = [item.to_dict() for item in self.tokens]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthTokenBasedConnectorAuth":
        return cls(
            type=data["type"],
            tokens=[
                CommonConnectorDefinitionsInputParametersItem.from_dict(item)
                for item in data["tokens"]
            ],
        )


CommonConnectorAuthOAuth2ConnectorAuthType = typing.Literal["oauth2"]

CommonConnectorAuthOAuth2ConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthOAuth2ConnectorAuthType
] = ["oauth2"]

CommonConnectorAuthOAuth2ConnectorAuthScopesItemKey = str

CommonConnectorAuthOAuth2ConnectorAuthScopesItemLabel = str

CommonConnectorAuthOAuth2ConnectorAuthScopesItemDescription = str

CommonConnectorAuthOAuth2ConnectorAuthScopesItemDefault = bool


@dataclass
class CommonConnectorAuthOAuth2ConnectorAuthScopesItem:
    key: CommonConnectorAuthOAuth2ConnectorAuthScopesItemKey
    label: CommonConnectorAuthOAuth2ConnectorAuthScopesItemLabel
    description: CommonConnectorAuthOAuth2ConnectorAuthScopesItemDescription
    default: typing.Optional[
        CommonConnectorAuthOAuth2ConnectorAuthScopesItemDefault
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["label"] = self.label
        data["description"] = self.description
        if self.default is not None:
            data["default"] = self.default
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthOAuth2ConnectorAuthScopesItem":
        return cls(
            key=str(data["key"]),
            label=str(data["label"]),
            description=str(data["description"]),
            default=None if data.get("default") is None else bool(data["default"]),
        )


CommonConnectorAuthOAuth2ConnectorAuthScopes = typing.List[
    CommonConnectorAuthOAuth2ConnectorAuthScopesItem
]

CommonConnectorAuthOAuth2ConnectorAuthParams = CommonConnectorDefinitionsInputParameters


@dataclass
class CommonConnectorAuthOAuth2ConnectorAuth:
    type: CommonConnectorAuthOAuth2ConnectorAuthType
    scopes: CommonConnectorAuthOAuth2ConnectorAuthScopes
    params: CommonConnectorAuthOAuth2ConnectorAuthParams

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["scopes"] = [item.to_dict() for item in self.scopes]
        data["params"] = [item.to_dict() for item in self.params]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthOAuth2ConnectorAuth":
        return cls(
            type=data["type"],
            scopes=[
                CommonConnectorAuthOAuth2ConnectorAuthScopesItem.from_dict(item)
                for item in data["scopes"]
            ],
            params=[
                CommonConnectorDefinitionsInputParametersItem.from_dict(item)
                for item in data["params"]
            ],
        )


CommonConnectorAuthManualConnectorAuthType = typing.Literal["manual"]

CommonConnectorAuthManualConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthManualConnectorAuthType
] = ["manual"]


@dataclass
class CommonConnectorAuthManualConnectorAuth:
    type: CommonConnectorAuthManualConnectorAuthType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthManualConnectorAuth":
        return cls(
            type=data["type"],
        )


CommonConnectorAuthEcdsaConnectorAuthType = typing.Literal["ecdsa"]

CommonConnectorAuthEcdsaConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthEcdsaConnectorAuthType
] = ["ecdsa"]

CommonConnectorAuthEcdsaConnectorAuthParams = CommonConnectorDefinitionsInputParameters


@dataclass
class CommonConnectorAuthEcdsaConnectorAuth:
    type: CommonConnectorAuthEcdsaConnectorAuthType
    params: CommonConnectorAuthEcdsaConnectorAuthParams

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["params"] = [item.to_dict() for item in self.params]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthEcdsaConnectorAuth":
        return cls(
            type=data["type"],
            params=[
                CommonConnectorDefinitionsInputParametersItem.from_dict(item)
                for item in data["params"]
            ],
        )


CommonConnectorAuthPublicConnectorAuthType = typing.Literal["public"]

CommonConnectorAuthPublicConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthPublicConnectorAuthType
] = ["public"]


@dataclass
class CommonConnectorAuthPublicConnectorAuth:
    type: CommonConnectorAuthPublicConnectorAuthType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthPublicConnectorAuth":
        return cls(
            type=data["type"],
        )


CommonConnectorAuthServiceAccountConnectorAuthType = typing.Literal["service-account"]

CommonConnectorAuthServiceAccountConnectorAuthTypeValues: typing.List[
    CommonConnectorAuthServiceAccountConnectorAuthType
] = ["service-account"]


@dataclass
class CommonConnectorAuthServiceAccountConnectorAuth:
    type: CommonConnectorAuthServiceAccountConnectorAuthType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorAuthServiceAccountConnectorAuth":
        return cls(
            type=data["type"],
        )


CommonConnectorAuth = typing.Union[
    CommonConnectorAuthTokenBasedConnectorAuth,
    CommonConnectorAuthOAuth2ConnectorAuth,
    CommonConnectorAuthManualConnectorAuth,
    CommonConnectorAuthEcdsaConnectorAuth,
    CommonConnectorAuthPublicConnectorAuth,
    CommonConnectorAuthServiceAccountConnectorAuth,
]


def common_connector_auth_from_dict(data: typing.Any) -> "CommonConnectorAuth":
    if isinstance(data, dict) and (data.get("type", None) == "tokens"):
        return CommonConnectorAuthTokenBasedConnectorAuth.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "oauth2"):
        return CommonConnectorAuthOAuth2ConnectorAuth.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "manual"):
        return CommonConnectorAuthManualConnectorAuth.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "ecdsa"):
        return CommonConnectorAuthEcdsaConnectorAuth.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "public"):
        return CommonConnectorAuthPublicConnectorAuth.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "service-account"):
        return CommonConnectorAuthServiceAccountConnectorAuth.from_dict(data)
    raise ValueError(f"Could not parse CommonConnectorAuth from dict: {data}")


CommonConnectorActionsItemKey = str

CommonConnectorActionsItemLabel = str

CommonConnectorActionsItemDescription = str

CommonConnectorActionsItemPayloadSchema = typing.Dict[str, typing.Any]

CommonConnectorActionsItemReturnSchema = typing.Dict[str, typing.Any]


@dataclass
class CommonConnectorActionsItem:
    key: CommonConnectorActionsItemKey
    label: CommonConnectorActionsItemLabel
    description: CommonConnectorActionsItemDescription
    payload_schema: CommonConnectorActionsItemPayloadSchema
    return_schema: CommonConnectorActionsItemReturnSchema

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["label"] = self.label
        data["description"] = self.description
        data["payloadSchema"] = self.payload_schema
        data["returnSchema"] = self.return_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorActionsItem":
        return cls(
            key=str(data["key"]),
            label=str(data["label"]),
            description=str(data["description"]),
            payload_schema=dict(**data["payloadSchema"]),
            return_schema=dict(**data["returnSchema"]),
        )


CommonConnectorActions = typing.List[CommonConnectorActionsItem]

CommonConnectorTriggersItemName = str

CommonConnectorTriggersItemDescription = str

CommonConnectorTriggersItemPayloadSchema = typing.Dict[str, typing.Any]


@dataclass
class CommonConnectorTriggersItem:
    name: CommonConnectorTriggersItemName
    description: CommonConnectorTriggersItemDescription
    payload_schema: typing.Optional[CommonConnectorTriggersItemPayloadSchema] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["description"] = self.description
        if self.payload_schema is not None:
            data["payloadSchema"] = self.payload_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonConnectorTriggersItem":
        return cls(
            name=str(data["name"]),
            description=str(data["description"]),
            payload_schema=None
            if data.get("payloadSchema") is None
            else dict(**data["payloadSchema"]),
        )


CommonConnectorTriggers = typing.List[CommonConnectorTriggersItem]


@dataclass
class CommonConnector:
    metadata: CommonConnectorMetadata
    auth: CommonConnectorAuth
    actions: CommonConnectorActions
    triggers: CommonConnectorTriggers

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["metadata"] = self.metadata.to_dict()
        data["auth"] = self.auth.to_dict()
        data["actions"] = [item.to_dict() for item in self.actions]
        data["triggers"] = [item.to_dict() for item in self.triggers]
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonConnector":
        return cls(
            metadata=CommonConnectorMetadata.from_dict(data["metadata"]),
            auth=(
                CommonConnectorAuthTokenBasedConnectorAuth.from_dict(data["auth"])
                if isinstance(data["auth"], dict)
                and (data["auth"].get("type", None) == "tokens")
                else CommonConnectorAuthOAuth2ConnectorAuth.from_dict(data["auth"])
                if isinstance(data["auth"], dict)
                and (data["auth"].get("type", None) == "oauth2")
                else CommonConnectorAuthManualConnectorAuth.from_dict(data["auth"])
                if isinstance(data["auth"], dict)
                and (data["auth"].get("type", None) == "manual")
                else CommonConnectorAuthEcdsaConnectorAuth.from_dict(data["auth"])
                if isinstance(data["auth"], dict)
                and (data["auth"].get("type", None) == "ecdsa")
                else CommonConnectorAuthPublicConnectorAuth.from_dict(data["auth"])
                if isinstance(data["auth"], dict)
                and (data["auth"].get("type", None) == "public")
                else CommonConnectorAuthServiceAccountConnectorAuth.from_dict(
                    data["auth"]
                )
            ),
            actions=[
                CommonConnectorActionsItem.from_dict(item) for item in data["actions"]
            ],
            triggers=[
                CommonConnectorTriggersItem.from_dict(item) for item in data["triggers"]
            ],
        )


CommonTablesPgTypes = typing.Union[
    typing.Literal["bigint"],
    typing.Literal["int8"],
    typing.Literal["bigserial"],
    typing.Literal["serial8"],
    typing.Literal["bit"],
    typing.Literal["bit varying"],
    typing.Literal["varbit"],
    typing.Literal["boolean"],
    typing.Literal["bool"],
    typing.Literal["box"],
    typing.Literal["bytea"],
    typing.Literal["character"],
    typing.Literal["char"],
    typing.Literal["character varying"],
    typing.Literal["varchar"],
    typing.Literal["cidr"],
    typing.Literal["circle"],
    typing.Literal["date"],
    typing.Literal["double precision"],
    typing.Literal["float8"],
    typing.Literal["inet"],
    typing.Literal["integer"],
    typing.Literal["int"],
    typing.Literal["int4"],
    typing.Literal["interval"],
    typing.Literal["json"],
    typing.Literal["jsonb"],
    typing.Literal["line"],
    typing.Literal["lseg"],
    typing.Literal["macaddr"],
    typing.Literal["money"],
    typing.Literal["numeric"],
    typing.Literal["decimal"],
    typing.Literal["path"],
    typing.Literal["pg_lsn"],
    typing.Literal["point"],
    typing.Literal["polygon"],
    typing.Literal["real"],
    typing.Literal["float4"],
    typing.Literal["smallint"],
    typing.Literal["int2"],
    typing.Literal["smallserial"],
    typing.Literal["serial2"],
    typing.Literal["serial"],
    typing.Literal["serial4"],
    typing.Literal["text"],
    typing.Literal["time"],
    typing.Literal["time with time zone"],
    typing.Literal["timetz"],
    typing.Literal["timestamp"],
    typing.Literal["timestamp with time zone"],
    typing.Literal["timestamptz"],
    typing.Literal["tsquery"],
    typing.Literal["tsvector"],
    typing.Literal["txid_snapshot"],
    typing.Literal["uuid"],
    typing.Literal["xml"],
]

CommonTablesPgTypesValues: typing.List[CommonTablesPgTypes] = [
    "bigint",
    "int8",
    "bigserial",
    "serial8",
    "bit",
    "bit varying",
    "varbit",
    "boolean",
    "bool",
    "box",
    "bytea",
    "character",
    "char",
    "character varying",
    "varchar",
    "cidr",
    "circle",
    "date",
    "double precision",
    "float8",
    "inet",
    "integer",
    "int",
    "int4",
    "interval",
    "json",
    "jsonb",
    "line",
    "lseg",
    "macaddr",
    "money",
    "numeric",
    "decimal",
    "path",
    "pg_lsn",
    "point",
    "polygon",
    "real",
    "float4",
    "smallint",
    "int2",
    "smallserial",
    "serial2",
    "serial",
    "serial4",
    "text",
    "time",
    "time with time zone",
    "timetz",
    "timestamp",
    "timestamp with time zone",
    "timestamptz",
    "tsquery",
    "tsvector",
    "txid_snapshot",
    "uuid",
    "xml",
]

CommonUserId = str

CommonUserEmail = str

CommonUserRolesItem = str

CommonUserRoles = typing.List[CommonUserRolesItem]

CommonUserProjectId = str

CommonUserCreatedAt = str


@dataclass
class CommonUser:
    id: CommonUserId
    email: CommonUserEmail
    roles: CommonUserRoles
    project_id: CommonUserProjectId
    created_at: CommonUserCreatedAt

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["email"] = self.email
        data["roles"] = self.roles
        data["projectId"] = self.project_id
        data["createdAt"] = self.created_at
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonUser":
        return cls(
            id=str(data["id"]),
            email=str(data["email"]),
            roles=[str(item) for item in data["roles"]],
            project_id=str(data["projectId"]),
            created_at=str(data["createdAt"]),
        )


CommonTablesSnapshotTablesItemId = str

CommonTablesSnapshotTablesItemName = str

CommonTablesSnapshotTablesItemColumnsItemId = str

CommonTablesSnapshotTablesItemColumnsItemPrimaryKey = bool

CommonTablesSnapshotTablesItemColumnsItemName = str

CommonTablesSnapshotTablesItemColumnsItemType = CommonTablesPgTypes

CommonTablesSnapshotTablesItemColumnsItemUnique = bool

CommonTablesSnapshotTablesItemColumnsItemNullable = bool

CommonTablesSnapshotTablesItemColumnsItemDefault = str

CommonTablesSnapshotTablesItemColumnsItemForeignKeyColumnId = str


@dataclass
class CommonTablesSnapshotTablesItemColumnsItemForeignKey:
    column_id: CommonTablesSnapshotTablesItemColumnsItemForeignKeyColumnId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["columnId"] = self.column_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonTablesSnapshotTablesItemColumnsItemForeignKey":
        return cls(
            column_id=str(data["columnId"]),
        )


@dataclass
class CommonTablesSnapshotTablesItemColumnsItem:
    id: CommonTablesSnapshotTablesItemColumnsItemId
    primary_key: CommonTablesSnapshotTablesItemColumnsItemPrimaryKey
    name: CommonTablesSnapshotTablesItemColumnsItemName
    type: CommonTablesSnapshotTablesItemColumnsItemType
    unique: typing.Optional[CommonTablesSnapshotTablesItemColumnsItemUnique] = field(
        default_factory=lambda: None
    )
    nullable: typing.Optional[CommonTablesSnapshotTablesItemColumnsItemNullable] = (
        field(default_factory=lambda: None)
    )
    default: typing.Optional[CommonTablesSnapshotTablesItemColumnsItemDefault] = field(
        default_factory=lambda: None
    )
    foreign_key: typing.Optional[
        CommonTablesSnapshotTablesItemColumnsItemForeignKey
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["primaryKey"] = self.primary_key
        data["name"] = self.name
        data["type"] = self.type
        if self.unique is not None:
            data["unique"] = self.unique
        if self.nullable is not None:
            data["nullable"] = self.nullable
        if self.default is not None:
            data["default"] = self.default
        if self.foreign_key is not None:
            data["foreignKey"] = self.foreign_key.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonTablesSnapshotTablesItemColumnsItem":
        return cls(
            id=str(data["id"]),
            primary_key=bool(data["primaryKey"]),
            name=str(data["name"]),
            type=data["type"],
            unique=None if data.get("unique") is None else bool(data["unique"]),
            nullable=None if data.get("nullable") is None else bool(data["nullable"]),
            default=None if data.get("default") is None else str(data["default"]),
            foreign_key=None
            if data.get("foreignKey") is None
            else CommonTablesSnapshotTablesItemColumnsItemForeignKey.from_dict(
                data["foreignKey"]
            ),
        )


CommonTablesSnapshotTablesItemColumns = typing.List[
    CommonTablesSnapshotTablesItemColumnsItem
]

CommonTablesSnapshotTablesItemDataItem = typing.Dict[str, typing.Any]

CommonTablesSnapshotTablesItemData = typing.List[CommonTablesSnapshotTablesItemDataItem]


@dataclass
class CommonTablesSnapshotTablesItem:
    id: CommonTablesSnapshotTablesItemId
    name: CommonTablesSnapshotTablesItemName
    columns: CommonTablesSnapshotTablesItemColumns
    data: CommonTablesSnapshotTablesItemData

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["name"] = self.name
        data["columns"] = [item.to_dict() for item in self.columns]
        data["data"] = [item for item in self.data]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonTablesSnapshotTablesItem":
        return cls(
            id=str(data["id"]),
            name=str(data["name"]),
            columns=[
                CommonTablesSnapshotTablesItemColumnsItem.from_dict(item)
                for item in data["columns"]
            ],
            data=[dict(**item) for item in data["data"]],
        )


CommonTablesSnapshotTables = typing.List[CommonTablesSnapshotTablesItem]


@dataclass
class CommonTablesSnapshot:
    tables: CommonTablesSnapshotTables

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["tables"] = [item.to_dict() for item in self.tables]
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonTablesSnapshot":
        return cls(
            tables=[
                CommonTablesSnapshotTablesItem.from_dict(item)
                for item in data["tables"]
            ],
        )


CommonOrganizationId = str

CommonOrganizationName = str

CommonOrganizationFeatureFlagsPROJECTLIVE = bool

CommonOrganizationFeatureFlagsALLOWRELEASE = bool

CommonOrganizationFeatureFlagsCONNECTORSCONSOLE = bool

CommonOrganizationFeatureFlagsDUPLICATEPROJECTS = bool

CommonOrganizationFeatureFlagsWEBEDITOR = bool

CommonOrganizationFeatureFlagsLANGCHAINSMARTCHAT = bool

CommonOrganizationFeatureFlagsENABLESERVERGEVENT = bool

CommonOrganizationFeatureFlagsENABLEWORKERPODS = bool

CommonOrganizationFeatureFlagsCOMPONENTSTAGE = bool

CommonOrganizationFeatureFlagsWHITELISTIPSENABLED = bool

CommonOrganizationFeatureFlagsGEMINI = bool

CommonOrganizationFeatureFlagsAGENTS = bool

CommonOrganizationFeatureFlagsCENTRALSCHEDULER = bool

CommonOrganizationFeatureFlagsKATAFIRECRACKER = bool

CommonOrganizationFeatureFlagsCLOUDWORKEREXECUTIONS = bool

CommonOrganizationFeatureFlagsUSEKIMI = bool

CommonOrganizationFeatureFlagsPAGES = bool


@dataclass
class CommonOrganizationFeatureFlags:
    p_r_o_j_e_c_t_l_i_v_e: CommonOrganizationFeatureFlagsPROJECTLIVE
    a_l_l_o_w_r_e_l_e_a_s_e: CommonOrganizationFeatureFlagsALLOWRELEASE
    c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e: CommonOrganizationFeatureFlagsCONNECTORSCONSOLE
    d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s: CommonOrganizationFeatureFlagsDUPLICATEPROJECTS
    e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t: (
        CommonOrganizationFeatureFlagsENABLESERVERGEVENT
    )
    e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s: CommonOrganizationFeatureFlagsENABLEWORKERPODS
    c_o_m_p_o_n_e_n_t_s_t_a_g_e: CommonOrganizationFeatureFlagsCOMPONENTSTAGE
    w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d: (
        CommonOrganizationFeatureFlagsWHITELISTIPSENABLED
    )
    g_e_m_i_n_i: CommonOrganizationFeatureFlagsGEMINI
    p_a_g_e_s: CommonOrganizationFeatureFlagsPAGES
    w_e_b_e_d_i_t_o_r: typing.Optional[CommonOrganizationFeatureFlagsWEBEDITOR] = field(
        default_factory=lambda: None
    )
    l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t: typing.Optional[
        CommonOrganizationFeatureFlagsLANGCHAINSMARTCHAT
    ] = field(default_factory=lambda: None)
    a_g_e_n_t_s: typing.Optional[CommonOrganizationFeatureFlagsAGENTS] = field(
        default_factory=lambda: None
    )
    c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r: typing.Optional[
        CommonOrganizationFeatureFlagsCENTRALSCHEDULER
    ] = field(default_factory=lambda: None)
    k_a_t_a_f_i_r_e_c_r_a_c_k_e_r: typing.Optional[
        CommonOrganizationFeatureFlagsKATAFIRECRACKER
    ] = field(default_factory=lambda: None)
    c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s: typing.Optional[
        CommonOrganizationFeatureFlagsCLOUDWORKEREXECUTIONS
    ] = field(default_factory=lambda: None)
    u_s_e_k_i_m_i: typing.Optional[CommonOrganizationFeatureFlagsUSEKIMI] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["PROJECT_LIVE"] = self.p_r_o_j_e_c_t_l_i_v_e
        data["ALLOW_RELEASE"] = self.a_l_l_o_w_r_e_l_e_a_s_e
        data["CONNECTORS_CONSOLE"] = self.c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e
        data["DUPLICATE_PROJECTS"] = self.d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s
        data["ENABLE_SERVER_GEVENT"] = self.e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t
        data["ENABLE_WORKER_PODS"] = self.e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s
        data["COMPONENT_STAGE"] = self.c_o_m_p_o_n_e_n_t_s_t_a_g_e
        data["WHITELIST_IPS_ENABLED"] = self.w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d
        data["GEMINI"] = self.g_e_m_i_n_i
        data["PAGES"] = self.p_a_g_e_s
        if self.w_e_b_e_d_i_t_o_r is not None:
            data["WEB_EDITOR"] = self.w_e_b_e_d_i_t_o_r
        if self.l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t is not None:
            data["LANGCHAIN_SMART_CHAT"] = self.l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t
        if self.a_g_e_n_t_s is not None:
            data["AGENTS"] = self.a_g_e_n_t_s
        if self.c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r is not None:
            data["CENTRAL_SCHEDULER"] = self.c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r
        if self.k_a_t_a_f_i_r_e_c_r_a_c_k_e_r is not None:
            data["KATA_FIRECRACKER"] = self.k_a_t_a_f_i_r_e_c_r_a_c_k_e_r
        if self.c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s is not None:
            data["CLOUD_WORKER_EXECUTIONS"] = (
                self.c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s
            )
        if self.u_s_e_k_i_m_i is not None:
            data["USE_KIMI"] = self.u_s_e_k_i_m_i
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonOrganizationFeatureFlags":
        return cls(
            p_r_o_j_e_c_t_l_i_v_e=bool(data["PROJECT_LIVE"]),
            a_l_l_o_w_r_e_l_e_a_s_e=bool(data["ALLOW_RELEASE"]),
            c_o_n_n_e_c_t_o_r_s_c_o_n_s_o_l_e=bool(data["CONNECTORS_CONSOLE"]),
            d_u_p_l_i_c_a_t_e_p_r_o_j_e_c_t_s=bool(data["DUPLICATE_PROJECTS"]),
            e_n_a_b_l_e_s_e_r_v_e_r_g_e_v_e_n_t=bool(data["ENABLE_SERVER_GEVENT"]),
            e_n_a_b_l_e_w_o_r_k_e_r_p_o_d_s=bool(data["ENABLE_WORKER_PODS"]),
            c_o_m_p_o_n_e_n_t_s_t_a_g_e=bool(data["COMPONENT_STAGE"]),
            w_h_i_t_e_l_i_s_t_i_p_s_e_n_a_b_l_e_d=bool(data["WHITELIST_IPS_ENABLED"]),
            g_e_m_i_n_i=bool(data["GEMINI"]),
            p_a_g_e_s=bool(data["PAGES"]),
            w_e_b_e_d_i_t_o_r=None
            if data.get("WEB_EDITOR") is None
            else bool(data["WEB_EDITOR"]),
            l_a_n_g_c_h_a_i_n_s_m_a_r_t_c_h_a_t=None
            if data.get("LANGCHAIN_SMART_CHAT") is None
            else bool(data["LANGCHAIN_SMART_CHAT"]),
            a_g_e_n_t_s=None if data.get("AGENTS") is None else bool(data["AGENTS"]),
            c_e_n_t_r_a_l_s_c_h_e_d_u_l_e_r=None
            if data.get("CENTRAL_SCHEDULER") is None
            else bool(data["CENTRAL_SCHEDULER"]),
            k_a_t_a_f_i_r_e_c_r_a_c_k_e_r=None
            if data.get("KATA_FIRECRACKER") is None
            else bool(data["KATA_FIRECRACKER"]),
            c_l_o_u_d_w_o_r_k_e_r_e_x_e_c_u_t_i_o_n_s=None
            if data.get("CLOUD_WORKER_EXECUTIONS") is None
            else bool(data["CLOUD_WORKER_EXECUTIONS"]),
            u_s_e_k_i_m_i=None
            if data.get("USE_KIMI") is None
            else bool(data["USE_KIMI"]),
        )


CommonOrganizationBillingMetadataPlan = str

CommonOrganizationBillingMetadataFinanceCustomerId = str

CommonOrganizationBillingMetadataExpires = str

CommonOrganizationBillingMetadataMessage = str

CommonOrganizationBillingMetadataMessageLink = str

CommonOrganizationBillingMetadataMessageCTA = str


@dataclass
class CommonOrganizationBillingMetadata:
    plan: typing.Optional[CommonOrganizationBillingMetadataPlan] = field(
        default_factory=lambda: None
    )
    finance_customer_id: typing.Optional[
        CommonOrganizationBillingMetadataFinanceCustomerId
    ] = field(default_factory=lambda: None)
    expires: typing.Optional[CommonOrganizationBillingMetadataExpires] = field(
        default_factory=lambda: None
    )
    message: typing.Optional[CommonOrganizationBillingMetadataMessage] = field(
        default_factory=lambda: None
    )
    message_link: typing.Optional[CommonOrganizationBillingMetadataMessageLink] = field(
        default_factory=lambda: None
    )
    message_c_t_a: typing.Optional[CommonOrganizationBillingMetadataMessageCTA] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.plan is not None:
            data["plan"] = self.plan
        if self.finance_customer_id is not None:
            data["financeCustomerId"] = self.finance_customer_id
        if self.expires is not None:
            data["expires"] = self.expires
        if self.message is not None:
            data["message"] = self.message
        if self.message_link is not None:
            data["messageLink"] = self.message_link
        if self.message_c_t_a is not None:
            data["messageCTA"] = self.message_c_t_a
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonOrganizationBillingMetadata":
        return cls(
            plan=None if data.get("plan") is None else str(data["plan"]),
            finance_customer_id=None
            if data.get("financeCustomerId") is None
            else str(data["financeCustomerId"]),
            expires=None if data.get("expires") is None else str(data["expires"]),
            message=None if data.get("message") is None else str(data["message"]),
            message_link=None
            if data.get("messageLink") is None
            else str(data["messageLink"]),
            message_c_t_a=None
            if data.get("messageCTA") is None
            else str(data["messageCTA"]),
        )


CommonOrganizationDeploymentResourcesWatermarkEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonOrganizationDeploymentResourcesWatermarkEnabledValues: typing.List[
    CommonOrganizationDeploymentResourcesWatermarkEnabled
] = ["true", "false"]

CommonOrganizationDeploymentResourcesNativeTempDir = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonOrganizationDeploymentResourcesNativeTempDirValues: typing.List[
    CommonOrganizationDeploymentResourcesNativeTempDir
] = ["true", "false"]

CommonOrganizationDeploymentResourcesNotificationsEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonOrganizationDeploymentResourcesNotificationsEnabledValues: typing.List[
    CommonOrganizationDeploymentResourcesNotificationsEnabled
] = ["true", "false"]

CommonOrganizationDeploymentResourcesUseCloudApiPlayer = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonOrganizationDeploymentResourcesUseCloudApiPlayerValues: typing.List[
    CommonOrganizationDeploymentResourcesUseCloudApiPlayer
] = ["true", "false"]

CommonOrganizationDeploymentResourcesRequestsCPU = str

CommonOrganizationDeploymentResourcesLimitsCPU = str

CommonOrganizationDeploymentResourcesRequestsMemory = str

CommonOrganizationDeploymentResourcesLimitsMemory = str

CommonOrganizationDeploymentResourcesMinReplicas = str

CommonOrganizationDeploymentResourcesComputeUnits = float

CommonOrganizationDeploymentResourcesServerComputeUnits = float

CommonOrganizationDeploymentResourcesTimeoutSeconds = str

CommonOrganizationDeploymentResourcesWorkerType = str

CommonOrganizationDeploymentResourcesPythonVersion = typing.Union[
    typing.Literal["3.9"],
    typing.Literal["3.10"],
    typing.Literal["3.11"],
    typing.Literal["3.12"],
]

CommonOrganizationDeploymentResourcesPythonVersionValues: typing.List[
    CommonOrganizationDeploymentResourcesPythonVersion
] = ["3.9", "3.10", "3.11", "3.12"]

CommonOrganizationDeploymentResourcesWorkerNumber = str

CommonOrganizationDeploymentResourcesBaseDockerfile = str

CommonOrganizationDeploymentResourcesQueueMessagesPerWorker = str

CommonOrganizationDeploymentResourcesAutoscaleMinWorker = str

CommonOrganizationDeploymentResourcesAutoscaleMaxWorker = str

CommonOrganizationDeploymentResourcesExecutorPoolSize = str

CommonOrganizationDeploymentResourcesMinFormsExecutors = str

CommonOrganizationDeploymentResourcesExecutorMaxExecutions = str

CommonOrganizationDeploymentResourcesExecutorWarmupParallelism = str


@dataclass
class CommonOrganizationDeploymentResources:
    watermark_enabled: typing.Optional[
        CommonOrganizationDeploymentResourcesWatermarkEnabled
    ] = field(default_factory=lambda: None)
    native_temp_dir: typing.Optional[
        CommonOrganizationDeploymentResourcesNativeTempDir
    ] = field(default_factory=lambda: None)
    notifications_enabled: typing.Optional[
        CommonOrganizationDeploymentResourcesNotificationsEnabled
    ] = field(default_factory=lambda: None)
    use_cloud_api_player: typing.Optional[
        CommonOrganizationDeploymentResourcesUseCloudApiPlayer
    ] = field(default_factory=lambda: None)
    requests_c_p_u: typing.Optional[
        CommonOrganizationDeploymentResourcesRequestsCPU
    ] = field(default_factory=lambda: None)
    limits_c_p_u: typing.Optional[CommonOrganizationDeploymentResourcesLimitsCPU] = (
        field(default_factory=lambda: None)
    )
    requests_memory: typing.Optional[
        CommonOrganizationDeploymentResourcesRequestsMemory
    ] = field(default_factory=lambda: None)
    limits_memory: typing.Optional[
        CommonOrganizationDeploymentResourcesLimitsMemory
    ] = field(default_factory=lambda: None)
    min_replicas: typing.Optional[CommonOrganizationDeploymentResourcesMinReplicas] = (
        field(default_factory=lambda: None)
    )
    compute_units: typing.Optional[
        CommonOrganizationDeploymentResourcesComputeUnits
    ] = field(default_factory=lambda: None)
    server_compute_units: typing.Optional[
        CommonOrganizationDeploymentResourcesServerComputeUnits
    ] = field(default_factory=lambda: None)
    timeout_seconds: typing.Optional[
        CommonOrganizationDeploymentResourcesTimeoutSeconds
    ] = field(default_factory=lambda: None)
    worker_type: typing.Optional[CommonOrganizationDeploymentResourcesWorkerType] = (
        field(default_factory=lambda: None)
    )
    python_version: typing.Optional[
        CommonOrganizationDeploymentResourcesPythonVersion
    ] = field(default_factory=lambda: None)
    worker_number: typing.Optional[
        CommonOrganizationDeploymentResourcesWorkerNumber
    ] = field(default_factory=lambda: None)
    base_dockerfile: typing.Optional[
        CommonOrganizationDeploymentResourcesBaseDockerfile
    ] = field(default_factory=lambda: None)
    queue_messages_per_worker: typing.Optional[
        CommonOrganizationDeploymentResourcesQueueMessagesPerWorker
    ] = field(default_factory=lambda: None)
    autoscale_min_worker: typing.Optional[
        CommonOrganizationDeploymentResourcesAutoscaleMinWorker
    ] = field(default_factory=lambda: None)
    autoscale_max_worker: typing.Optional[
        CommonOrganizationDeploymentResourcesAutoscaleMaxWorker
    ] = field(default_factory=lambda: None)
    executor_pool_size: typing.Optional[
        CommonOrganizationDeploymentResourcesExecutorPoolSize
    ] = field(default_factory=lambda: None)
    min_forms_executors: typing.Optional[
        CommonOrganizationDeploymentResourcesMinFormsExecutors
    ] = field(default_factory=lambda: None)
    executor_max_executions: typing.Optional[
        CommonOrganizationDeploymentResourcesExecutorMaxExecutions
    ] = field(default_factory=lambda: None)
    executor_warmup_parallelism: typing.Optional[
        CommonOrganizationDeploymentResourcesExecutorWarmupParallelism
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.watermark_enabled is not None:
            data["watermarkEnabled"] = self.watermark_enabled
        if self.native_temp_dir is not None:
            data["nativeTempDir"] = self.native_temp_dir
        if self.notifications_enabled is not None:
            data["notificationsEnabled"] = self.notifications_enabled
        if self.use_cloud_api_player is not None:
            data["useCloudApiPlayer"] = self.use_cloud_api_player
        if self.requests_c_p_u is not None:
            data["requestsCPU"] = self.requests_c_p_u
        if self.limits_c_p_u is not None:
            data["limitsCPU"] = self.limits_c_p_u
        if self.requests_memory is not None:
            data["requestsMemory"] = self.requests_memory
        if self.limits_memory is not None:
            data["limitsMemory"] = self.limits_memory
        if self.min_replicas is not None:
            data["minReplicas"] = self.min_replicas
        if self.compute_units is not None:
            data["computeUnits"] = self.compute_units
        if self.server_compute_units is not None:
            data["serverComputeUnits"] = self.server_compute_units
        if self.timeout_seconds is not None:
            data["timeoutSeconds"] = self.timeout_seconds
        if self.worker_type is not None:
            data["workerType"] = self.worker_type
        if self.python_version is not None:
            data["pythonVersion"] = self.python_version
        if self.worker_number is not None:
            data["workerNumber"] = self.worker_number
        if self.base_dockerfile is not None:
            data["baseDockerfile"] = self.base_dockerfile
        if self.queue_messages_per_worker is not None:
            data["queueMessagesPerWorker"] = self.queue_messages_per_worker
        if self.autoscale_min_worker is not None:
            data["autoscaleMinWorker"] = self.autoscale_min_worker
        if self.autoscale_max_worker is not None:
            data["autoscaleMaxWorker"] = self.autoscale_max_worker
        if self.executor_pool_size is not None:
            data["executorPoolSize"] = self.executor_pool_size
        if self.min_forms_executors is not None:
            data["minFormsExecutors"] = self.min_forms_executors
        if self.executor_max_executions is not None:
            data["executorMaxExecutions"] = self.executor_max_executions
        if self.executor_warmup_parallelism is not None:
            data["executorWarmupParallelism"] = self.executor_warmup_parallelism
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonOrganizationDeploymentResources":
        return cls(
            watermark_enabled=None
            if data.get("watermarkEnabled") is None
            else data["watermarkEnabled"],
            native_temp_dir=None
            if data.get("nativeTempDir") is None
            else data["nativeTempDir"],
            notifications_enabled=None
            if data.get("notificationsEnabled") is None
            else data["notificationsEnabled"],
            use_cloud_api_player=None
            if data.get("useCloudApiPlayer") is None
            else data["useCloudApiPlayer"],
            requests_c_p_u=None
            if data.get("requestsCPU") is None
            else str(data["requestsCPU"]),
            limits_c_p_u=None
            if data.get("limitsCPU") is None
            else str(data["limitsCPU"]),
            requests_memory=None
            if data.get("requestsMemory") is None
            else str(data["requestsMemory"]),
            limits_memory=None
            if data.get("limitsMemory") is None
            else str(data["limitsMemory"]),
            min_replicas=None
            if data.get("minReplicas") is None
            else str(data["minReplicas"]),
            compute_units=None
            if data.get("computeUnits") is None
            else float(data["computeUnits"]),
            server_compute_units=None
            if data.get("serverComputeUnits") is None
            else float(data["serverComputeUnits"]),
            timeout_seconds=None
            if data.get("timeoutSeconds") is None
            else str(data["timeoutSeconds"]),
            worker_type=None
            if data.get("workerType") is None
            else str(data["workerType"]),
            python_version=None
            if data.get("pythonVersion") is None
            else data["pythonVersion"],
            worker_number=None
            if data.get("workerNumber") is None
            else str(data["workerNumber"]),
            base_dockerfile=None
            if data.get("baseDockerfile") is None
            else str(data["baseDockerfile"]),
            queue_messages_per_worker=None
            if data.get("queueMessagesPerWorker") is None
            else str(data["queueMessagesPerWorker"]),
            autoscale_min_worker=None
            if data.get("autoscaleMinWorker") is None
            else str(data["autoscaleMinWorker"]),
            autoscale_max_worker=None
            if data.get("autoscaleMaxWorker") is None
            else str(data["autoscaleMaxWorker"]),
            executor_pool_size=None
            if data.get("executorPoolSize") is None
            else str(data["executorPoolSize"]),
            min_forms_executors=None
            if data.get("minFormsExecutors") is None
            else str(data["minFormsExecutors"]),
            executor_max_executions=None
            if data.get("executorMaxExecutions") is None
            else str(data["executorMaxExecutions"]),
            executor_warmup_parallelism=None
            if data.get("executorWarmupParallelism") is None
            else str(data["executorWarmupParallelism"]),
        )


CommonOrganizationMembershipsMetadataWhitelistPatternsItem = str

CommonOrganizationMembershipsMetadataWhitelistPatterns = typing.List[
    CommonOrganizationMembershipsMetadataWhitelistPatternsItem
]


@dataclass
class CommonOrganizationMembershipsMetadata:
    whitelist_patterns: typing.Optional[
        CommonOrganizationMembershipsMetadataWhitelistPatterns
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.whitelist_patterns is not None:
            data["whitelistPatterns"] = self.whitelist_patterns
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonOrganizationMembershipsMetadata":
        return cls(
            whitelist_patterns=None
            if data.get("whitelistPatterns") is None
            else [str(item) for item in data["whitelistPatterns"]],
        )


@dataclass
class CommonOrganization:
    id: CommonOrganizationId
    name: CommonOrganizationName
    feature_flags: CommonOrganizationFeatureFlags
    billing_metadata: CommonOrganizationBillingMetadata
    deployment_resources: typing.Optional[CommonOrganizationDeploymentResources] = (
        field(default_factory=lambda: None)
    )
    memberships_metadata: typing.Optional[CommonOrganizationMembershipsMetadata] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["name"] = self.name
        data["featureFlags"] = self.feature_flags.to_dict()
        data["billingMetadata"] = self.billing_metadata.to_dict()
        if self.deployment_resources is not None:
            data["deploymentResources"] = self.deployment_resources.to_dict()
        if self.memberships_metadata is not None:
            data["membershipsMetadata"] = self.memberships_metadata.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonOrganization":
        return cls(
            id=str(data["id"]),
            name=str(data["name"]),
            feature_flags=CommonOrganizationFeatureFlags.from_dict(
                data["featureFlags"]
            ),
            billing_metadata=CommonOrganizationBillingMetadata.from_dict(
                data["billingMetadata"]
            ),
            deployment_resources=None
            if data.get("deploymentResources") is None
            else CommonOrganizationDeploymentResources.from_dict(
                data["deploymentResources"]
            ),
            memberships_metadata=None
            if data.get("membershipsMetadata") is None
            else CommonOrganizationMembershipsMetadata.from_dict(
                data["membershipsMetadata"]
            ),
        )


CommonPartialMembershipsMetadataWhitelistPatternsItem = str

CommonPartialMembershipsMetadataWhitelistPatterns = typing.List[
    CommonPartialMembershipsMetadataWhitelistPatternsItem
]


@dataclass
class CommonPartialMembershipsMetadata:
    whitelist_patterns: typing.Optional[
        CommonPartialMembershipsMetadataWhitelistPatterns
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.whitelist_patterns is not None:
            data["whitelistPatterns"] = self.whitelist_patterns
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonPartialMembershipsMetadata":
        return cls(
            whitelist_patterns=None
            if data.get("whitelistPatterns") is None
            else [str(item) for item in data["whitelistPatterns"]],
        )


CommonAbstraJsonV17WorkspaceName = str

CommonAbstraJsonV17WorkspaceLanguage = str

CommonAbstraJsonV17WorkspaceThemeString = str

CommonAbstraJsonV17WorkspaceThemeNull = type(None)

CommonAbstraJsonV17WorkspaceTheme = typing.Union[
    CommonAbstraJsonV17WorkspaceThemeString, CommonAbstraJsonV17WorkspaceThemeNull
]


def common_abstra_json_v17_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceLogoUrlString = str

CommonAbstraJsonV17WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV17WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV17WorkspaceLogoUrlString, CommonAbstraJsonV17WorkspaceLogoUrlNull
]


def common_abstra_json_v17_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceFaviconUrlString = str

CommonAbstraJsonV17WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV17WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV17WorkspaceFaviconUrlString,
    CommonAbstraJsonV17WorkspaceFaviconUrlNull,
]


def common_abstra_json_v17_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceBrandNameString = str

CommonAbstraJsonV17WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV17WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV17WorkspaceBrandNameString,
    CommonAbstraJsonV17WorkspaceBrandNameNull,
]


def common_abstra_json_v17_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceMainColorString = str

CommonAbstraJsonV17WorkspaceMainColorNull = type(None)

CommonAbstraJsonV17WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV17WorkspaceMainColorString,
    CommonAbstraJsonV17WorkspaceMainColorNull,
]


def common_abstra_json_v17_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceFontFamilyString = str

CommonAbstraJsonV17WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV17WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV17WorkspaceFontFamilyString,
    CommonAbstraJsonV17WorkspaceFontFamilyNull,
]


def common_abstra_json_v17_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV17WorkspaceFontColorString = str

CommonAbstraJsonV17WorkspaceFontColorNull = type(None)

CommonAbstraJsonV17WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV17WorkspaceFontColorString,
    CommonAbstraJsonV17WorkspaceFontColorNull,
]


def common_abstra_json_v17_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV17Workspace:
    name: CommonAbstraJsonV17WorkspaceName
    language: CommonAbstraJsonV17WorkspaceLanguage
    theme: CommonAbstraJsonV17WorkspaceTheme
    logo_url: CommonAbstraJsonV17WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV17WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV17WorkspaceBrandName
    main_color: CommonAbstraJsonV17WorkspaceMainColor
    font_family: CommonAbstraJsonV17WorkspaceFontFamily
    font_color: CommonAbstraJsonV17WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV17HomeAccessControlIsPublic = bool

CommonAbstraJsonV17HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV17HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV17HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV17HomeAccessControl:
    is_public: CommonAbstraJsonV17HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV17HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV17Home:
    access_control: CommonAbstraJsonV17HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV17Home":
        return cls(
            access_control=CommonAbstraJsonV17HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV17DefinitionsJobStageTitle = str

CommonAbstraJsonV17DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsJobStageId = str

CommonAbstraJsonV17DefinitionsJobStageInput = bool

CommonAbstraJsonV17DefinitionsTransitionId = str

CommonAbstraJsonV17DefinitionsTransitionTargetId = str

CommonAbstraJsonV17DefinitionsTransitionTargetType = str

CommonAbstraJsonV17DefinitionsTransitionType = str

CommonAbstraJsonV17DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV17DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV17DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV17DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV17DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v17_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV17DefinitionsTransition:
    id: CommonAbstraJsonV17DefinitionsTransitionId
    target_id: CommonAbstraJsonV17DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV17DefinitionsTransitionTargetType
    type: CommonAbstraJsonV17DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV17DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV17DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsJobStageOutput = bool

CommonAbstraJsonV17DefinitionsJobStageFile = str

CommonAbstraJsonV17DefinitionsJobStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV17DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV17DefinitionsJobStage:
    title: CommonAbstraJsonV17DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV17DefinitionsJobStageId
    input: CommonAbstraJsonV17DefinitionsJobStageInput
    transitions: CommonAbstraJsonV17DefinitionsJobStageTransitions
    output: CommonAbstraJsonV17DefinitionsJobStageOutput
    file: CommonAbstraJsonV17DefinitionsJobStageFile
    schedule: CommonAbstraJsonV17DefinitionsJobStageSchedule
    task_schema: typing.Optional[CommonAbstraJsonV17DefinitionsJobStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["schedule"] = self.schedule
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsJobStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            schedule=str(data["schedule"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV17JobsItem = CommonAbstraJsonV17DefinitionsJobStage

CommonAbstraJsonV17Jobs = typing.List[CommonAbstraJsonV17JobsItem]

CommonAbstraJsonV17DefinitionsHookStageTitle = str

CommonAbstraJsonV17DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsHookStageId = str

CommonAbstraJsonV17DefinitionsHookStageInput = bool

CommonAbstraJsonV17DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsHookStageOutput = bool

CommonAbstraJsonV17DefinitionsHookStageFile = str

CommonAbstraJsonV17DefinitionsHookStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV17DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV17DefinitionsHookStagePath = str

CommonAbstraJsonV17DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV17DefinitionsHookStage:
    title: CommonAbstraJsonV17DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV17DefinitionsHookStageId
    input: CommonAbstraJsonV17DefinitionsHookStageInput
    transitions: CommonAbstraJsonV17DefinitionsHookStageTransitions
    output: CommonAbstraJsonV17DefinitionsHookStageOutput
    file: CommonAbstraJsonV17DefinitionsHookStageFile
    is_initial: CommonAbstraJsonV17DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV17DefinitionsHookStagePath
    enabled: CommonAbstraJsonV17DefinitionsHookStageEnabled
    task_schema: typing.Optional[CommonAbstraJsonV17DefinitionsHookStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsHookStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV17HooksItem = CommonAbstraJsonV17DefinitionsHookStage

CommonAbstraJsonV17Hooks = typing.List[CommonAbstraJsonV17HooksItem]

CommonAbstraJsonV17DefinitionsFormStageTitle = str

CommonAbstraJsonV17DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsFormStageId = str

CommonAbstraJsonV17DefinitionsFormStageInput = bool

CommonAbstraJsonV17DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsFormStageOutput = bool

CommonAbstraJsonV17DefinitionsFormStageFile = str

CommonAbstraJsonV17DefinitionsFormStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV17DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV17DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV17DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV17DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV17DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v17_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV17DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV17DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV17DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV17DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v17_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV17DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV17DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV17DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV17DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v17_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV17DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV17DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV17DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV17DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV17DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV17DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV17DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV17DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV17DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV17DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV17DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV17DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v17_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV17DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV17DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV17DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV17DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v17_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV17DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV17DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV17DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV17DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV17DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV17DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV17DefinitionsFormStage:
    title: CommonAbstraJsonV17DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV17DefinitionsFormStageId
    input: CommonAbstraJsonV17DefinitionsFormStageInput
    transitions: CommonAbstraJsonV17DefinitionsFormStageTransitions
    output: CommonAbstraJsonV17DefinitionsFormStageOutput
    file: CommonAbstraJsonV17DefinitionsFormStageFile
    start_button_text: CommonAbstraJsonV17DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV17DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV17DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV17DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV17DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV17DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV17DefinitionsFormStageErrorMessage
    notification_trigger: CommonAbstraJsonV17DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV17DefinitionsFormStageAutoStart
    path: CommonAbstraJsonV17DefinitionsFormStagePath
    task_schema: typing.Optional[CommonAbstraJsonV17DefinitionsFormStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["path"] = self.path
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsFormStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV17DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV17DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            path=str(data["path"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV17FormsItem = CommonAbstraJsonV17DefinitionsFormStage

CommonAbstraJsonV17Forms = typing.List[CommonAbstraJsonV17FormsItem]

CommonAbstraJsonV17DefinitionsScriptStageTitle = str

CommonAbstraJsonV17DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsScriptStageId = str

CommonAbstraJsonV17DefinitionsScriptStageInput = bool

CommonAbstraJsonV17DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsScriptStageOutput = bool

CommonAbstraJsonV17DefinitionsScriptStageFile = str

CommonAbstraJsonV17DefinitionsScriptStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV17DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV17DefinitionsScriptStage:
    title: CommonAbstraJsonV17DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV17DefinitionsScriptStageId
    input: CommonAbstraJsonV17DefinitionsScriptStageInput
    transitions: CommonAbstraJsonV17DefinitionsScriptStageTransitions
    output: CommonAbstraJsonV17DefinitionsScriptStageOutput
    file: CommonAbstraJsonV17DefinitionsScriptStageFile
    is_initial: CommonAbstraJsonV17DefinitionsScriptStageIsInitial
    task_schema: typing.Optional[
        CommonAbstraJsonV17DefinitionsScriptStageTaskSchema
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["is_initial"] = self.is_initial
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsScriptStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            is_initial=bool(data["is_initial"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV17ScriptsItem = CommonAbstraJsonV17DefinitionsScriptStage

CommonAbstraJsonV17Scripts = typing.List[CommonAbstraJsonV17ScriptsItem]

CommonAbstraJsonV17DefinitionsComponentStageId = str

CommonAbstraJsonV17DefinitionsComponentStageTitle = str

CommonAbstraJsonV17DefinitionsComponentStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsComponentStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsComponentStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsComponentStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsComponentStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsComponentStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsComponentStageIsInitial = bool

CommonAbstraJsonV17DefinitionsComponentStagePackageNameString = str

CommonAbstraJsonV17DefinitionsComponentStagePackageNameNull = type(None)

CommonAbstraJsonV17DefinitionsComponentStagePackageName = typing.Union[
    CommonAbstraJsonV17DefinitionsComponentStagePackageNameString,
    CommonAbstraJsonV17DefinitionsComponentStagePackageNameNull,
]


def common_abstra_json_v17_definitions_component_stage_package_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsComponentStagePackageName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsComponentStagePackageName from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV17DefinitionsComponentStage:
    id: CommonAbstraJsonV17DefinitionsComponentStageId
    title: CommonAbstraJsonV17DefinitionsComponentStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsComponentStageWorkflowPosition
    transitions: CommonAbstraJsonV17DefinitionsComponentStageTransitions
    is_initial: CommonAbstraJsonV17DefinitionsComponentStageIsInitial
    package_name: typing.Optional[
        CommonAbstraJsonV17DefinitionsComponentStagePackageName
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["is_initial"] = self.is_initial
        if self.package_name is not None:
            data["package_name"] = self.package_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsComponentStage":
        return cls(
            id=str(data["id"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            is_initial=bool(data["is_initial"]),
            package_name=None
            if data.get("package_name") is None
            else (
                str(data["package_name"])
                if isinstance(data["package_name"], str)
                else None
            ),
        )


CommonAbstraJsonV17ComponentsItem = CommonAbstraJsonV17DefinitionsComponentStage

CommonAbstraJsonV17Components = typing.List[CommonAbstraJsonV17ComponentsItem]

CommonAbstraJsonV17DefinitionsAgentStageTitle = str

CommonAbstraJsonV17DefinitionsAgentStageWorkflowPositionItem = float

CommonAbstraJsonV17DefinitionsAgentStageWorkflowPosition = typing.List[
    CommonAbstraJsonV17DefinitionsAgentStageWorkflowPositionItem
]

CommonAbstraJsonV17DefinitionsAgentStageId = str

CommonAbstraJsonV17DefinitionsAgentStageInput = bool

CommonAbstraJsonV17DefinitionsAgentStageTransitionsItem = (
    CommonAbstraJsonV17DefinitionsTransition
)

CommonAbstraJsonV17DefinitionsAgentStageTransitions = typing.List[
    CommonAbstraJsonV17DefinitionsAgentStageTransitionsItem
]

CommonAbstraJsonV17DefinitionsAgentStageOutput = bool

CommonAbstraJsonV17DefinitionsAgentStageFile = str

CommonAbstraJsonV17DefinitionsAgentStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV17DefinitionsAgentStageIsInitial = bool

CommonAbstraJsonV17DefinitionsAgentPermissionType = typing.Union[
    typing.Literal["tables"], typing.Literal["files"], typing.Literal["connections"]
]

CommonAbstraJsonV17DefinitionsAgentPermissionTypeValues: typing.List[
    CommonAbstraJsonV17DefinitionsAgentPermissionType
] = ["tables", "files", "connections"]

CommonAbstraJsonV17DefinitionsAgentPermissionAction = str

CommonAbstraJsonV17DefinitionsAgentPermissionTableNameString = str

CommonAbstraJsonV17DefinitionsAgentPermissionTableNameNull = type(None)

CommonAbstraJsonV17DefinitionsAgentPermissionTableName = typing.Union[
    CommonAbstraJsonV17DefinitionsAgentPermissionTableNameString,
    CommonAbstraJsonV17DefinitionsAgentPermissionTableNameNull,
]


def common_abstra_json_v17_definitions_agent_permission_table_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsAgentPermissionTableName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsAgentPermissionTableName from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsAgentPermissionConnectionNameString = str

CommonAbstraJsonV17DefinitionsAgentPermissionConnectionNameNull = type(None)

CommonAbstraJsonV17DefinitionsAgentPermissionConnectionName = typing.Union[
    CommonAbstraJsonV17DefinitionsAgentPermissionConnectionNameString,
    CommonAbstraJsonV17DefinitionsAgentPermissionConnectionNameNull,
]


def common_abstra_json_v17_definitions_agent_permission_connection_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV17DefinitionsAgentPermissionConnectionName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV17DefinitionsAgentPermissionConnectionName from dict: {data}"
    )


CommonAbstraJsonV17DefinitionsAgentPermissionCondition = typing.Any


@dataclass
class CommonAbstraJsonV17DefinitionsAgentPermission:
    type: CommonAbstraJsonV17DefinitionsAgentPermissionType
    action: CommonAbstraJsonV17DefinitionsAgentPermissionAction
    table_name: typing.Optional[
        CommonAbstraJsonV17DefinitionsAgentPermissionTableName
    ] = field(default_factory=lambda: None)
    connection_name: typing.Optional[
        CommonAbstraJsonV17DefinitionsAgentPermissionConnectionName
    ] = field(default_factory=lambda: None)
    condition: typing.Optional[
        CommonAbstraJsonV17DefinitionsAgentPermissionCondition
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["action"] = self.action
        if self.table_name is not None:
            data["tableName"] = self.table_name
        if self.connection_name is not None:
            data["connectionName"] = self.connection_name
        if self.condition is not None:
            data["condition"] = self.condition
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsAgentPermission":
        return cls(
            type=data["type"],
            action=str(data["action"]),
            table_name=None
            if data.get("tableName") is None
            else (
                str(data["tableName"]) if isinstance(data["tableName"], str) else None
            ),
            connection_name=None
            if data.get("connectionName") is None
            else (
                str(data["connectionName"])
                if isinstance(data["connectionName"], str)
                else None
            ),
            condition=None if data.get("condition") is None else data["condition"],
        )


CommonAbstraJsonV17DefinitionsAgentStagePermissionsItem = (
    CommonAbstraJsonV17DefinitionsAgentPermission
)

CommonAbstraJsonV17DefinitionsAgentStagePermissions = typing.List[
    CommonAbstraJsonV17DefinitionsAgentStagePermissionsItem
]

CommonAbstraJsonV17DefinitionsAgentStageMaxSteps = int


@dataclass
class CommonAbstraJsonV17DefinitionsAgentStage:
    title: CommonAbstraJsonV17DefinitionsAgentStageTitle
    workflow_position: CommonAbstraJsonV17DefinitionsAgentStageWorkflowPosition
    id: CommonAbstraJsonV17DefinitionsAgentStageId
    input: CommonAbstraJsonV17DefinitionsAgentStageInput
    transitions: CommonAbstraJsonV17DefinitionsAgentStageTransitions
    output: CommonAbstraJsonV17DefinitionsAgentStageOutput
    file: CommonAbstraJsonV17DefinitionsAgentStageFile
    is_initial: CommonAbstraJsonV17DefinitionsAgentStageIsInitial
    permissions: CommonAbstraJsonV17DefinitionsAgentStagePermissions
    task_schema: typing.Optional[CommonAbstraJsonV17DefinitionsAgentStageTaskSchema] = (
        field(default_factory=lambda: None)
    )
    max_steps: typing.Optional[CommonAbstraJsonV17DefinitionsAgentStageMaxSteps] = (
        field(default_factory=lambda: 30)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["is_initial"] = self.is_initial
        data["permissions"] = [item.to_dict() for item in self.permissions]
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        if self.max_steps is not None:
            data["max_steps"] = self.max_steps
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV17DefinitionsAgentStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV17DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            is_initial=bool(data["is_initial"]),
            permissions=[
                CommonAbstraJsonV17DefinitionsAgentPermission.from_dict(item)
                for item in data["permissions"]
            ],
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
            max_steps=data.get("max_steps", 30),
        )


CommonAbstraJsonV17AgentsItem = CommonAbstraJsonV17DefinitionsAgentStage

CommonAbstraJsonV17Agents = typing.List[CommonAbstraJsonV17AgentsItem]

CommonAbstraJsonV17InputsItem = str

CommonAbstraJsonV17Inputs = typing.List[CommonAbstraJsonV17InputsItem]

CommonAbstraJsonV17OutputsItem = str

CommonAbstraJsonV17Outputs = typing.List[CommonAbstraJsonV17OutputsItem]

CommonAbstraJsonV17Version = typing.Literal["17.0"]

CommonAbstraJsonV17VersionValues: typing.List[CommonAbstraJsonV17Version] = ["17.0"]


@dataclass
class CommonAbstraJsonV17:
    workspace: CommonAbstraJsonV17Workspace
    home: CommonAbstraJsonV17Home
    jobs: CommonAbstraJsonV17Jobs
    hooks: CommonAbstraJsonV17Hooks
    forms: CommonAbstraJsonV17Forms
    scripts: CommonAbstraJsonV17Scripts
    agents: CommonAbstraJsonV17Agents
    version: CommonAbstraJsonV17Version
    components: typing.Optional[CommonAbstraJsonV17Components] = field(
        default_factory=lambda: None
    )
    inputs: typing.Optional[CommonAbstraJsonV17Inputs] = field(
        default_factory=lambda: None
    )
    outputs: typing.Optional[CommonAbstraJsonV17Outputs] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["agents"] = [item.to_dict() for item in self.agents]
        data["version"] = self.version
        if self.components is not None:
            data["components"] = [item.to_dict() for item in self.components]
        if self.inputs is not None:
            data["inputs"] = self.inputs
        if self.outputs is not None:
            data["outputs"] = self.outputs
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV17":
        return cls(
            workspace=CommonAbstraJsonV17Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV17Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV17DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV17DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV17DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV17DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            agents=[
                CommonAbstraJsonV17DefinitionsAgentStage.from_dict(item)
                for item in data["agents"]
            ],
            version=data["version"],
            components=None
            if data.get("components") is None
            else [
                CommonAbstraJsonV17DefinitionsComponentStage.from_dict(item)
                for item in data["components"]
            ],
            inputs=None
            if data.get("inputs") is None
            else [str(item) for item in data["inputs"]],
            outputs=None
            if data.get("outputs") is None
            else [str(item) for item in data["outputs"]],
        )


CommonAbstraJsonV16WorkspaceName = str

CommonAbstraJsonV16WorkspaceLanguage = str

CommonAbstraJsonV16WorkspaceThemeString = str

CommonAbstraJsonV16WorkspaceThemeNull = type(None)

CommonAbstraJsonV16WorkspaceTheme = typing.Union[
    CommonAbstraJsonV16WorkspaceThemeString, CommonAbstraJsonV16WorkspaceThemeNull
]


def common_abstra_json_v16_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceLogoUrlString = str

CommonAbstraJsonV16WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV16WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV16WorkspaceLogoUrlString, CommonAbstraJsonV16WorkspaceLogoUrlNull
]


def common_abstra_json_v16_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceFaviconUrlString = str

CommonAbstraJsonV16WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV16WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV16WorkspaceFaviconUrlString,
    CommonAbstraJsonV16WorkspaceFaviconUrlNull,
]


def common_abstra_json_v16_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceBrandNameString = str

CommonAbstraJsonV16WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV16WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV16WorkspaceBrandNameString,
    CommonAbstraJsonV16WorkspaceBrandNameNull,
]


def common_abstra_json_v16_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceMainColorString = str

CommonAbstraJsonV16WorkspaceMainColorNull = type(None)

CommonAbstraJsonV16WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV16WorkspaceMainColorString,
    CommonAbstraJsonV16WorkspaceMainColorNull,
]


def common_abstra_json_v16_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceFontFamilyString = str

CommonAbstraJsonV16WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV16WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV16WorkspaceFontFamilyString,
    CommonAbstraJsonV16WorkspaceFontFamilyNull,
]


def common_abstra_json_v16_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV16WorkspaceFontColorString = str

CommonAbstraJsonV16WorkspaceFontColorNull = type(None)

CommonAbstraJsonV16WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV16WorkspaceFontColorString,
    CommonAbstraJsonV16WorkspaceFontColorNull,
]


def common_abstra_json_v16_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV16Workspace:
    name: CommonAbstraJsonV16WorkspaceName
    language: CommonAbstraJsonV16WorkspaceLanguage
    theme: CommonAbstraJsonV16WorkspaceTheme
    logo_url: CommonAbstraJsonV16WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV16WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV16WorkspaceBrandName
    main_color: CommonAbstraJsonV16WorkspaceMainColor
    font_family: CommonAbstraJsonV16WorkspaceFontFamily
    font_color: CommonAbstraJsonV16WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV16HomeAccessControlIsPublic = bool

CommonAbstraJsonV16HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV16HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV16HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV16HomeAccessControl:
    is_public: CommonAbstraJsonV16HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV16HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV16Home:
    access_control: CommonAbstraJsonV16HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV16Home":
        return cls(
            access_control=CommonAbstraJsonV16HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV16DefinitionsTransitionId = str

CommonAbstraJsonV16DefinitionsTransitionTargetId = str

CommonAbstraJsonV16DefinitionsTransitionTargetType = str

CommonAbstraJsonV16DefinitionsTransitionType = str

CommonAbstraJsonV16DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV16DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV16DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV16DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV16DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v16_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV16DefinitionsTransition:
    id: CommonAbstraJsonV16DefinitionsTransitionId
    target_id: CommonAbstraJsonV16DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV16DefinitionsTransitionTargetType
    type: CommonAbstraJsonV16DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV16DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV16DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV16DefinitionsTransition
)

CommonAbstraJsonV16DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV16DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV16DefinitionsJobStageFile = str

CommonAbstraJsonV16DefinitionsJobStageTitle = str

CommonAbstraJsonV16DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV16DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV16DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV16DefinitionsJobStageId = str

CommonAbstraJsonV16DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV16DefinitionsJobStage:
    transitions: CommonAbstraJsonV16DefinitionsJobStageTransitions
    file: CommonAbstraJsonV16DefinitionsJobStageFile
    title: CommonAbstraJsonV16DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV16DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV16DefinitionsJobStageId
    schedule: CommonAbstraJsonV16DefinitionsJobStageSchedule

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["schedule"] = self.schedule
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsJobStage":
        return cls(
            transitions=[
                CommonAbstraJsonV16DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            schedule=str(data["schedule"]),
        )


CommonAbstraJsonV16JobsItem = CommonAbstraJsonV16DefinitionsJobStage

CommonAbstraJsonV16Jobs = typing.List[CommonAbstraJsonV16JobsItem]

CommonAbstraJsonV16DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV16DefinitionsTransition
)

CommonAbstraJsonV16DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV16DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV16DefinitionsHookStageFile = str

CommonAbstraJsonV16DefinitionsHookStageTitle = str

CommonAbstraJsonV16DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV16DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV16DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV16DefinitionsHookStageId = str

CommonAbstraJsonV16DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV16DefinitionsHookStagePath = str

CommonAbstraJsonV16DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV16DefinitionsHookStage:
    transitions: CommonAbstraJsonV16DefinitionsHookStageTransitions
    file: CommonAbstraJsonV16DefinitionsHookStageFile
    title: CommonAbstraJsonV16DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV16DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV16DefinitionsHookStageId
    is_initial: CommonAbstraJsonV16DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV16DefinitionsHookStagePath
    enabled: CommonAbstraJsonV16DefinitionsHookStageEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsHookStage":
        return cls(
            transitions=[
                CommonAbstraJsonV16DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV16HooksItem = CommonAbstraJsonV16DefinitionsHookStage

CommonAbstraJsonV16Hooks = typing.List[CommonAbstraJsonV16HooksItem]

CommonAbstraJsonV16DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV16DefinitionsTransition
)

CommonAbstraJsonV16DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV16DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV16DefinitionsFormStageFile = str

CommonAbstraJsonV16DefinitionsFormStageTitle = str

CommonAbstraJsonV16DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV16DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV16DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV16DefinitionsFormStageId = str

CommonAbstraJsonV16DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV16DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV16DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV16DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV16DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v16_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV16DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV16DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV16DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV16DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV16DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v16_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV16DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV16DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV16DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV16DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV16DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v16_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV16DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV16DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV16DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV16DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV16DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV16DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV16DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV16DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV16DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV16DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV16DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV16DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV16DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v16_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV16DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV16DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV16DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV16DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV16DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v16_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV16DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV16DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV16DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV16DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV16DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV16DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV16DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV16DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV16DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV16DefinitionsFormStage:
    transitions: CommonAbstraJsonV16DefinitionsFormStageTransitions
    file: CommonAbstraJsonV16DefinitionsFormStageFile
    title: CommonAbstraJsonV16DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV16DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV16DefinitionsFormStageId
    start_button_text: CommonAbstraJsonV16DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV16DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV16DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV16DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV16DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV16DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV16DefinitionsFormStageErrorMessage
    notification_trigger: CommonAbstraJsonV16DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV16DefinitionsFormStageAutoStart
    path: CommonAbstraJsonV16DefinitionsFormStagePath

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["path"] = self.path
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsFormStage":
        return cls(
            transitions=[
                CommonAbstraJsonV16DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV16DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV16DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            path=str(data["path"]),
        )


CommonAbstraJsonV16FormsItem = CommonAbstraJsonV16DefinitionsFormStage

CommonAbstraJsonV16Forms = typing.List[CommonAbstraJsonV16FormsItem]

CommonAbstraJsonV16DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV16DefinitionsTransition
)

CommonAbstraJsonV16DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV16DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV16DefinitionsScriptStageFile = str

CommonAbstraJsonV16DefinitionsScriptStageTitle = str

CommonAbstraJsonV16DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV16DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV16DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV16DefinitionsScriptStageId = str

CommonAbstraJsonV16DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV16DefinitionsScriptStage:
    transitions: CommonAbstraJsonV16DefinitionsScriptStageTransitions
    file: CommonAbstraJsonV16DefinitionsScriptStageFile
    title: CommonAbstraJsonV16DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV16DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV16DefinitionsScriptStageId
    is_initial: CommonAbstraJsonV16DefinitionsScriptStageIsInitial

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV16DefinitionsScriptStage":
        return cls(
            transitions=[
                CommonAbstraJsonV16DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
        )


CommonAbstraJsonV16ScriptsItem = CommonAbstraJsonV16DefinitionsScriptStage

CommonAbstraJsonV16Scripts = typing.List[CommonAbstraJsonV16ScriptsItem]

CommonAbstraJsonV16Version = typing.Literal["16.0"]

CommonAbstraJsonV16VersionValues: typing.List[CommonAbstraJsonV16Version] = ["16.0"]


@dataclass
class CommonAbstraJsonV16:
    workspace: CommonAbstraJsonV16Workspace
    home: CommonAbstraJsonV16Home
    jobs: CommonAbstraJsonV16Jobs
    hooks: CommonAbstraJsonV16Hooks
    forms: CommonAbstraJsonV16Forms
    scripts: CommonAbstraJsonV16Scripts
    version: CommonAbstraJsonV16Version

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV16":
        return cls(
            workspace=CommonAbstraJsonV16Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV16Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV16DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV16DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV16DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV16DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            version=data["version"],
        )


CommonAbstraJsonV15WorkspaceName = str

CommonAbstraJsonV15WorkspaceLanguage = str

CommonAbstraJsonV15WorkspaceThemeString = str

CommonAbstraJsonV15WorkspaceThemeNull = type(None)

CommonAbstraJsonV15WorkspaceTheme = typing.Union[
    CommonAbstraJsonV15WorkspaceThemeString, CommonAbstraJsonV15WorkspaceThemeNull
]


def common_abstra_json_v15_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceLogoUrlString = str

CommonAbstraJsonV15WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV15WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV15WorkspaceLogoUrlString, CommonAbstraJsonV15WorkspaceLogoUrlNull
]


def common_abstra_json_v15_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceFaviconUrlString = str

CommonAbstraJsonV15WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV15WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV15WorkspaceFaviconUrlString,
    CommonAbstraJsonV15WorkspaceFaviconUrlNull,
]


def common_abstra_json_v15_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceBrandNameString = str

CommonAbstraJsonV15WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV15WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV15WorkspaceBrandNameString,
    CommonAbstraJsonV15WorkspaceBrandNameNull,
]


def common_abstra_json_v15_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceMainColorString = str

CommonAbstraJsonV15WorkspaceMainColorNull = type(None)

CommonAbstraJsonV15WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV15WorkspaceMainColorString,
    CommonAbstraJsonV15WorkspaceMainColorNull,
]


def common_abstra_json_v15_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceFontFamilyString = str

CommonAbstraJsonV15WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV15WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV15WorkspaceFontFamilyString,
    CommonAbstraJsonV15WorkspaceFontFamilyNull,
]


def common_abstra_json_v15_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV15WorkspaceFontColorString = str

CommonAbstraJsonV15WorkspaceFontColorNull = type(None)

CommonAbstraJsonV15WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV15WorkspaceFontColorString,
    CommonAbstraJsonV15WorkspaceFontColorNull,
]


def common_abstra_json_v15_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV15Workspace:
    name: CommonAbstraJsonV15WorkspaceName
    language: CommonAbstraJsonV15WorkspaceLanguage
    theme: CommonAbstraJsonV15WorkspaceTheme
    logo_url: CommonAbstraJsonV15WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV15WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV15WorkspaceBrandName
    main_color: CommonAbstraJsonV15WorkspaceMainColor
    font_family: CommonAbstraJsonV15WorkspaceFontFamily
    font_color: CommonAbstraJsonV15WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV15HomeAccessControlIsPublic = bool

CommonAbstraJsonV15HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV15HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV15HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV15HomeAccessControl:
    is_public: CommonAbstraJsonV15HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV15HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV15Home:
    access_control: CommonAbstraJsonV15HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV15Home":
        return cls(
            access_control=CommonAbstraJsonV15HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV15DefinitionsTransitionId = str

CommonAbstraJsonV15DefinitionsTransitionTargetId = str

CommonAbstraJsonV15DefinitionsTransitionTargetType = str

CommonAbstraJsonV15DefinitionsTransitionType = str

CommonAbstraJsonV15DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV15DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV15DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV15DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV15DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v15_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV15DefinitionsTransition:
    id: CommonAbstraJsonV15DefinitionsTransitionId
    target_id: CommonAbstraJsonV15DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV15DefinitionsTransitionTargetType
    type: CommonAbstraJsonV15DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV15DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV15DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV15DefinitionsTransition
)

CommonAbstraJsonV15DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV15DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV15DefinitionsJobStageFile = str

CommonAbstraJsonV15DefinitionsJobStageTitle = str

CommonAbstraJsonV15DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV15DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV15DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV15DefinitionsJobStageId = str

CommonAbstraJsonV15DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV15DefinitionsJobStage:
    transitions: CommonAbstraJsonV15DefinitionsJobStageTransitions
    file: CommonAbstraJsonV15DefinitionsJobStageFile
    title: CommonAbstraJsonV15DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV15DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV15DefinitionsJobStageId
    schedule: CommonAbstraJsonV15DefinitionsJobStageSchedule

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["schedule"] = self.schedule
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsJobStage":
        return cls(
            transitions=[
                CommonAbstraJsonV15DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            schedule=str(data["schedule"]),
        )


CommonAbstraJsonV15JobsItem = CommonAbstraJsonV15DefinitionsJobStage

CommonAbstraJsonV15Jobs = typing.List[CommonAbstraJsonV15JobsItem]

CommonAbstraJsonV15DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV15DefinitionsTransition
)

CommonAbstraJsonV15DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV15DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV15DefinitionsHookStageFile = str

CommonAbstraJsonV15DefinitionsHookStageTitle = str

CommonAbstraJsonV15DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV15DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV15DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV15DefinitionsHookStageId = str

CommonAbstraJsonV15DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV15DefinitionsHookStagePath = str

CommonAbstraJsonV15DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV15DefinitionsHookStage:
    transitions: CommonAbstraJsonV15DefinitionsHookStageTransitions
    file: CommonAbstraJsonV15DefinitionsHookStageFile
    title: CommonAbstraJsonV15DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV15DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV15DefinitionsHookStageId
    is_initial: CommonAbstraJsonV15DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV15DefinitionsHookStagePath
    enabled: CommonAbstraJsonV15DefinitionsHookStageEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsHookStage":
        return cls(
            transitions=[
                CommonAbstraJsonV15DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV15HooksItem = CommonAbstraJsonV15DefinitionsHookStage

CommonAbstraJsonV15Hooks = typing.List[CommonAbstraJsonV15HooksItem]

CommonAbstraJsonV15DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV15DefinitionsTransition
)

CommonAbstraJsonV15DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV15DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV15DefinitionsFormStageFile = str

CommonAbstraJsonV15DefinitionsFormStageTitle = str

CommonAbstraJsonV15DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV15DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV15DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV15DefinitionsFormStageId = str

CommonAbstraJsonV15DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV15DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV15DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV15DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV15DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v15_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV15DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV15DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV15DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV15DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV15DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v15_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV15DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV15DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV15DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV15DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV15DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v15_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV15DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV15DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV15DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV15DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV15DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV15DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV15DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV15DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV15DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV15DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV15DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV15DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV15DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v15_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV15DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV15DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV15DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV15DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV15DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v15_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV15DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV15DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV15DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV15DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV15DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV15DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV15DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV15DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV15DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV15DefinitionsFormStage:
    transitions: CommonAbstraJsonV15DefinitionsFormStageTransitions
    file: CommonAbstraJsonV15DefinitionsFormStageFile
    title: CommonAbstraJsonV15DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV15DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV15DefinitionsFormStageId
    start_button_text: CommonAbstraJsonV15DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV15DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV15DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV15DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV15DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV15DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV15DefinitionsFormStageErrorMessage
    notification_trigger: CommonAbstraJsonV15DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV15DefinitionsFormStageAutoStart
    path: CommonAbstraJsonV15DefinitionsFormStagePath

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["path"] = self.path
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsFormStage":
        return cls(
            transitions=[
                CommonAbstraJsonV15DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV15DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV15DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            path=str(data["path"]),
        )


CommonAbstraJsonV15FormsItem = CommonAbstraJsonV15DefinitionsFormStage

CommonAbstraJsonV15Forms = typing.List[CommonAbstraJsonV15FormsItem]

CommonAbstraJsonV15DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV15DefinitionsTransition
)

CommonAbstraJsonV15DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV15DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV15DefinitionsScriptStageFile = str

CommonAbstraJsonV15DefinitionsScriptStageTitle = str

CommonAbstraJsonV15DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV15DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV15DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV15DefinitionsScriptStageId = str

CommonAbstraJsonV15DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV15DefinitionsScriptStage:
    transitions: CommonAbstraJsonV15DefinitionsScriptStageTransitions
    file: CommonAbstraJsonV15DefinitionsScriptStageFile
    title: CommonAbstraJsonV15DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV15DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV15DefinitionsScriptStageId
    is_initial: CommonAbstraJsonV15DefinitionsScriptStageIsInitial

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV15DefinitionsScriptStage":
        return cls(
            transitions=[
                CommonAbstraJsonV15DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
        )


CommonAbstraJsonV15ScriptsItem = CommonAbstraJsonV15DefinitionsScriptStage

CommonAbstraJsonV15Scripts = typing.List[CommonAbstraJsonV15ScriptsItem]

CommonAbstraJsonV15Version = typing.Literal["15.0"]

CommonAbstraJsonV15VersionValues: typing.List[CommonAbstraJsonV15Version] = ["15.0"]


@dataclass
class CommonAbstraJsonV15:
    workspace: CommonAbstraJsonV15Workspace
    home: CommonAbstraJsonV15Home
    jobs: CommonAbstraJsonV15Jobs
    hooks: CommonAbstraJsonV15Hooks
    forms: CommonAbstraJsonV15Forms
    scripts: CommonAbstraJsonV15Scripts
    version: CommonAbstraJsonV15Version

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV15":
        return cls(
            workspace=CommonAbstraJsonV15Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV15Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV15DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV15DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV15DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV15DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            version=data["version"],
        )


CommonAbstraJsonV18WorkspaceName = str

CommonAbstraJsonV18WorkspaceLanguage = str

CommonAbstraJsonV18WorkspaceThemeString = str

CommonAbstraJsonV18WorkspaceThemeNull = type(None)

CommonAbstraJsonV18WorkspaceTheme = typing.Union[
    CommonAbstraJsonV18WorkspaceThemeString, CommonAbstraJsonV18WorkspaceThemeNull
]


def common_abstra_json_v18_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceLogoUrlString = str

CommonAbstraJsonV18WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV18WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV18WorkspaceLogoUrlString, CommonAbstraJsonV18WorkspaceLogoUrlNull
]


def common_abstra_json_v18_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceFaviconUrlString = str

CommonAbstraJsonV18WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV18WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV18WorkspaceFaviconUrlString,
    CommonAbstraJsonV18WorkspaceFaviconUrlNull,
]


def common_abstra_json_v18_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceBrandNameString = str

CommonAbstraJsonV18WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV18WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV18WorkspaceBrandNameString,
    CommonAbstraJsonV18WorkspaceBrandNameNull,
]


def common_abstra_json_v18_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceMainColorString = str

CommonAbstraJsonV18WorkspaceMainColorNull = type(None)

CommonAbstraJsonV18WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV18WorkspaceMainColorString,
    CommonAbstraJsonV18WorkspaceMainColorNull,
]


def common_abstra_json_v18_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceFontFamilyString = str

CommonAbstraJsonV18WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV18WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV18WorkspaceFontFamilyString,
    CommonAbstraJsonV18WorkspaceFontFamilyNull,
]


def common_abstra_json_v18_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV18WorkspaceFontColorString = str

CommonAbstraJsonV18WorkspaceFontColorNull = type(None)

CommonAbstraJsonV18WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV18WorkspaceFontColorString,
    CommonAbstraJsonV18WorkspaceFontColorNull,
]


def common_abstra_json_v18_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV18Workspace:
    name: CommonAbstraJsonV18WorkspaceName
    language: CommonAbstraJsonV18WorkspaceLanguage
    theme: CommonAbstraJsonV18WorkspaceTheme
    logo_url: CommonAbstraJsonV18WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV18WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV18WorkspaceBrandName
    main_color: CommonAbstraJsonV18WorkspaceMainColor
    font_family: CommonAbstraJsonV18WorkspaceFontFamily
    font_color: CommonAbstraJsonV18WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV18HomeAccessControlIsPublic = bool

CommonAbstraJsonV18HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV18HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV18HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV18HomeAccessControl:
    is_public: CommonAbstraJsonV18HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV18HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV18Home:
    access_control: CommonAbstraJsonV18HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV18Home":
        return cls(
            access_control=CommonAbstraJsonV18HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV18DefinitionsJobStageTitle = str

CommonAbstraJsonV18DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV18DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV18DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV18DefinitionsJobStageId = str

CommonAbstraJsonV18DefinitionsJobStageInput = bool

CommonAbstraJsonV18DefinitionsTransitionId = str

CommonAbstraJsonV18DefinitionsTransitionTargetId = str

CommonAbstraJsonV18DefinitionsTransitionTargetType = str

CommonAbstraJsonV18DefinitionsTransitionType = str

CommonAbstraJsonV18DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV18DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV18DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV18DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV18DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v18_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV18DefinitionsTransition:
    id: CommonAbstraJsonV18DefinitionsTransitionId
    target_id: CommonAbstraJsonV18DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV18DefinitionsTransitionTargetType
    type: CommonAbstraJsonV18DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV18DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV18DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV18DefinitionsTransition
)

CommonAbstraJsonV18DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV18DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV18DefinitionsJobStageOutput = bool

CommonAbstraJsonV18DefinitionsJobStageFile = str

CommonAbstraJsonV18DefinitionsJobStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV18DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV18DefinitionsJobStage:
    title: CommonAbstraJsonV18DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV18DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV18DefinitionsJobStageId
    input: CommonAbstraJsonV18DefinitionsJobStageInput
    transitions: CommonAbstraJsonV18DefinitionsJobStageTransitions
    output: CommonAbstraJsonV18DefinitionsJobStageOutput
    file: CommonAbstraJsonV18DefinitionsJobStageFile
    schedule: CommonAbstraJsonV18DefinitionsJobStageSchedule
    task_schema: typing.Optional[CommonAbstraJsonV18DefinitionsJobStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["schedule"] = self.schedule
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsJobStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV18DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            schedule=str(data["schedule"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV18JobsItem = CommonAbstraJsonV18DefinitionsJobStage

CommonAbstraJsonV18Jobs = typing.List[CommonAbstraJsonV18JobsItem]

CommonAbstraJsonV18DefinitionsHookStageTitle = str

CommonAbstraJsonV18DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV18DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV18DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV18DefinitionsHookStageId = str

CommonAbstraJsonV18DefinitionsHookStageInput = bool

CommonAbstraJsonV18DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV18DefinitionsTransition
)

CommonAbstraJsonV18DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV18DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV18DefinitionsHookStageOutput = bool

CommonAbstraJsonV18DefinitionsHookStageFile = str

CommonAbstraJsonV18DefinitionsHookStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV18DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV18DefinitionsHookStagePath = str

CommonAbstraJsonV18DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV18DefinitionsHookStage:
    title: CommonAbstraJsonV18DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV18DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV18DefinitionsHookStageId
    input: CommonAbstraJsonV18DefinitionsHookStageInput
    transitions: CommonAbstraJsonV18DefinitionsHookStageTransitions
    output: CommonAbstraJsonV18DefinitionsHookStageOutput
    file: CommonAbstraJsonV18DefinitionsHookStageFile
    is_initial: CommonAbstraJsonV18DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV18DefinitionsHookStagePath
    enabled: CommonAbstraJsonV18DefinitionsHookStageEnabled
    task_schema: typing.Optional[CommonAbstraJsonV18DefinitionsHookStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsHookStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV18DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV18HooksItem = CommonAbstraJsonV18DefinitionsHookStage

CommonAbstraJsonV18Hooks = typing.List[CommonAbstraJsonV18HooksItem]

CommonAbstraJsonV18DefinitionsFormStageTitle = str

CommonAbstraJsonV18DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV18DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV18DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV18DefinitionsFormStageId = str

CommonAbstraJsonV18DefinitionsFormStageInput = bool

CommonAbstraJsonV18DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV18DefinitionsTransition
)

CommonAbstraJsonV18DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV18DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV18DefinitionsFormStageOutput = bool

CommonAbstraJsonV18DefinitionsFormStageFile = str

CommonAbstraJsonV18DefinitionsFormStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV18DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV18DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV18DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV18DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV18DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v18_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV18DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV18DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV18DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV18DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV18DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v18_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV18DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV18DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV18DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV18DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV18DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v18_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV18DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV18DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV18DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV18DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV18DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV18DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV18DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV18DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV18DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV18DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV18DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV18DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV18DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v18_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV18DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV18DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV18DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV18DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV18DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v18_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV18DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV18DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV18DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV18DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV18DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV18DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV18DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV18DefinitionsFormStage:
    title: CommonAbstraJsonV18DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV18DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV18DefinitionsFormStageId
    input: CommonAbstraJsonV18DefinitionsFormStageInput
    transitions: CommonAbstraJsonV18DefinitionsFormStageTransitions
    output: CommonAbstraJsonV18DefinitionsFormStageOutput
    file: CommonAbstraJsonV18DefinitionsFormStageFile
    start_button_text: CommonAbstraJsonV18DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV18DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV18DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV18DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV18DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV18DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV18DefinitionsFormStageErrorMessage
    notification_trigger: CommonAbstraJsonV18DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV18DefinitionsFormStageAutoStart
    path: CommonAbstraJsonV18DefinitionsFormStagePath
    task_schema: typing.Optional[CommonAbstraJsonV18DefinitionsFormStageTaskSchema] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["path"] = self.path
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsFormStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV18DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV18DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV18DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            path=str(data["path"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV18FormsItem = CommonAbstraJsonV18DefinitionsFormStage

CommonAbstraJsonV18Forms = typing.List[CommonAbstraJsonV18FormsItem]

CommonAbstraJsonV18DefinitionsScriptStageTitle = str

CommonAbstraJsonV18DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV18DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV18DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV18DefinitionsScriptStageId = str

CommonAbstraJsonV18DefinitionsScriptStageInput = bool

CommonAbstraJsonV18DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV18DefinitionsTransition
)

CommonAbstraJsonV18DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV18DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV18DefinitionsScriptStageOutput = bool

CommonAbstraJsonV18DefinitionsScriptStageFile = str

CommonAbstraJsonV18DefinitionsScriptStageTaskSchema = typing.Dict[str, typing.Any]

CommonAbstraJsonV18DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV18DefinitionsScriptStage:
    title: CommonAbstraJsonV18DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV18DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV18DefinitionsScriptStageId
    input: CommonAbstraJsonV18DefinitionsScriptStageInput
    transitions: CommonAbstraJsonV18DefinitionsScriptStageTransitions
    output: CommonAbstraJsonV18DefinitionsScriptStageOutput
    file: CommonAbstraJsonV18DefinitionsScriptStageFile
    is_initial: CommonAbstraJsonV18DefinitionsScriptStageIsInitial
    task_schema: typing.Optional[
        CommonAbstraJsonV18DefinitionsScriptStageTaskSchema
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["input"] = self.input
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["output"] = self.output
        data["file"] = self.file
        data["is_initial"] = self.is_initial
        if self.task_schema is not None:
            data["task_schema"] = self.task_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsScriptStage":
        return cls(
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            input=bool(data["input"]),
            transitions=[
                CommonAbstraJsonV18DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            output=bool(data["output"]),
            file=str(data["file"]),
            is_initial=bool(data["is_initial"]),
            task_schema=None
            if data.get("task_schema") is None
            else dict(**data["task_schema"]),
        )


CommonAbstraJsonV18ScriptsItem = CommonAbstraJsonV18DefinitionsScriptStage

CommonAbstraJsonV18Scripts = typing.List[CommonAbstraJsonV18ScriptsItem]

CommonAbstraJsonV18DefinitionsComponentStageId = str

CommonAbstraJsonV18DefinitionsComponentStageTitle = str

CommonAbstraJsonV18DefinitionsComponentStageWorkflowPositionItem = float

CommonAbstraJsonV18DefinitionsComponentStageWorkflowPosition = typing.List[
    CommonAbstraJsonV18DefinitionsComponentStageWorkflowPositionItem
]

CommonAbstraJsonV18DefinitionsComponentStageTransitionsItem = (
    CommonAbstraJsonV18DefinitionsTransition
)

CommonAbstraJsonV18DefinitionsComponentStageTransitions = typing.List[
    CommonAbstraJsonV18DefinitionsComponentStageTransitionsItem
]

CommonAbstraJsonV18DefinitionsComponentStageIsInitial = bool

CommonAbstraJsonV18DefinitionsComponentStagePackageNameString = str

CommonAbstraJsonV18DefinitionsComponentStagePackageNameNull = type(None)

CommonAbstraJsonV18DefinitionsComponentStagePackageName = typing.Union[
    CommonAbstraJsonV18DefinitionsComponentStagePackageNameString,
    CommonAbstraJsonV18DefinitionsComponentStagePackageNameNull,
]


def common_abstra_json_v18_definitions_component_stage_package_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV18DefinitionsComponentStagePackageName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV18DefinitionsComponentStagePackageName from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV18DefinitionsComponentStage:
    id: CommonAbstraJsonV18DefinitionsComponentStageId
    title: CommonAbstraJsonV18DefinitionsComponentStageTitle
    workflow_position: CommonAbstraJsonV18DefinitionsComponentStageWorkflowPosition
    transitions: CommonAbstraJsonV18DefinitionsComponentStageTransitions
    is_initial: CommonAbstraJsonV18DefinitionsComponentStageIsInitial
    package_name: typing.Optional[
        CommonAbstraJsonV18DefinitionsComponentStagePackageName
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["is_initial"] = self.is_initial
        if self.package_name is not None:
            data["package_name"] = self.package_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV18DefinitionsComponentStage":
        return cls(
            id=str(data["id"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            transitions=[
                CommonAbstraJsonV18DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            is_initial=bool(data["is_initial"]),
            package_name=None
            if data.get("package_name") is None
            else (
                str(data["package_name"])
                if isinstance(data["package_name"], str)
                else None
            ),
        )


CommonAbstraJsonV18ComponentsItem = CommonAbstraJsonV18DefinitionsComponentStage

CommonAbstraJsonV18Components = typing.List[CommonAbstraJsonV18ComponentsItem]

CommonAbstraJsonV18InputsItem = str

CommonAbstraJsonV18Inputs = typing.List[CommonAbstraJsonV18InputsItem]

CommonAbstraJsonV18OutputsItem = str

CommonAbstraJsonV18Outputs = typing.List[CommonAbstraJsonV18OutputsItem]

CommonAbstraJsonV18Version = typing.Literal["17.0"]

CommonAbstraJsonV18VersionValues: typing.List[CommonAbstraJsonV18Version] = ["17.0"]


@dataclass
class CommonAbstraJsonV18:
    workspace: CommonAbstraJsonV18Workspace
    home: CommonAbstraJsonV18Home
    jobs: CommonAbstraJsonV18Jobs
    hooks: CommonAbstraJsonV18Hooks
    forms: CommonAbstraJsonV18Forms
    scripts: CommonAbstraJsonV18Scripts
    version: CommonAbstraJsonV18Version
    components: typing.Optional[CommonAbstraJsonV18Components] = field(
        default_factory=lambda: None
    )
    inputs: typing.Optional[CommonAbstraJsonV18Inputs] = field(
        default_factory=lambda: None
    )
    outputs: typing.Optional[CommonAbstraJsonV18Outputs] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["version"] = self.version
        if self.components is not None:
            data["components"] = [item.to_dict() for item in self.components]
        if self.inputs is not None:
            data["inputs"] = self.inputs
        if self.outputs is not None:
            data["outputs"] = self.outputs
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV18":
        return cls(
            workspace=CommonAbstraJsonV18Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV18Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV18DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV18DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV18DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV18DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            version=data["version"],
            components=None
            if data.get("components") is None
            else [
                CommonAbstraJsonV18DefinitionsComponentStage.from_dict(item)
                for item in data["components"]
            ],
            inputs=None
            if data.get("inputs") is None
            else [str(item) for item in data["inputs"]],
            outputs=None
            if data.get("outputs") is None
            else [str(item) for item in data["outputs"]],
        )


CommonAbstraJsonV14WorkspaceName = str

CommonAbstraJsonV14WorkspaceLanguage = str

CommonAbstraJsonV14WorkspaceThemeString = str

CommonAbstraJsonV14WorkspaceThemeNull = type(None)

CommonAbstraJsonV14WorkspaceTheme = typing.Union[
    CommonAbstraJsonV14WorkspaceThemeString, CommonAbstraJsonV14WorkspaceThemeNull
]


def common_abstra_json_v14_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceLogoUrlString = str

CommonAbstraJsonV14WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV14WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV14WorkspaceLogoUrlString, CommonAbstraJsonV14WorkspaceLogoUrlNull
]


def common_abstra_json_v14_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceFaviconUrlString = str

CommonAbstraJsonV14WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV14WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV14WorkspaceFaviconUrlString,
    CommonAbstraJsonV14WorkspaceFaviconUrlNull,
]


def common_abstra_json_v14_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceBrandNameString = str

CommonAbstraJsonV14WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV14WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV14WorkspaceBrandNameString,
    CommonAbstraJsonV14WorkspaceBrandNameNull,
]


def common_abstra_json_v14_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceMainColorString = str

CommonAbstraJsonV14WorkspaceMainColorNull = type(None)

CommonAbstraJsonV14WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV14WorkspaceMainColorString,
    CommonAbstraJsonV14WorkspaceMainColorNull,
]


def common_abstra_json_v14_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceFontFamilyString = str

CommonAbstraJsonV14WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV14WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV14WorkspaceFontFamilyString,
    CommonAbstraJsonV14WorkspaceFontFamilyNull,
]


def common_abstra_json_v14_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV14WorkspaceFontColorString = str

CommonAbstraJsonV14WorkspaceFontColorNull = type(None)

CommonAbstraJsonV14WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV14WorkspaceFontColorString,
    CommonAbstraJsonV14WorkspaceFontColorNull,
]


def common_abstra_json_v14_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV14Workspace:
    name: CommonAbstraJsonV14WorkspaceName
    language: CommonAbstraJsonV14WorkspaceLanguage
    theme: CommonAbstraJsonV14WorkspaceTheme
    logo_url: CommonAbstraJsonV14WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV14WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV14WorkspaceBrandName
    main_color: CommonAbstraJsonV14WorkspaceMainColor
    font_family: CommonAbstraJsonV14WorkspaceFontFamily
    font_color: CommonAbstraJsonV14WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV14HomeAccessControlIsPublic = bool

CommonAbstraJsonV14HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV14HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV14HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV14HomeAccessControl:
    is_public: CommonAbstraJsonV14HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV14HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV14Home:
    access_control: CommonAbstraJsonV14HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV14Home":
        return cls(
            access_control=CommonAbstraJsonV14HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV14DefinitionsTransitionId = str

CommonAbstraJsonV14DefinitionsTransitionTargetId = str

CommonAbstraJsonV14DefinitionsTransitionTargetType = str

CommonAbstraJsonV14DefinitionsTransitionType = typing.Literal["task"]

CommonAbstraJsonV14DefinitionsTransitionTypeValues: typing.List[
    CommonAbstraJsonV14DefinitionsTransitionType
] = ["task"]

CommonAbstraJsonV14DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV14DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV14DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV14DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV14DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v14_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV14DefinitionsTransition:
    id: CommonAbstraJsonV14DefinitionsTransitionId
    target_id: CommonAbstraJsonV14DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV14DefinitionsTransitionTargetType
    type: CommonAbstraJsonV14DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV14DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=data["type"],
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV14DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV14DefinitionsTransition
)

CommonAbstraJsonV14DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV14DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV14DefinitionsJobStageFile = str

CommonAbstraJsonV14DefinitionsJobStageTitle = str

CommonAbstraJsonV14DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV14DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV14DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV14DefinitionsJobStageId = str

CommonAbstraJsonV14DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV14DefinitionsJobStage:
    transitions: CommonAbstraJsonV14DefinitionsJobStageTransitions
    file: CommonAbstraJsonV14DefinitionsJobStageFile
    title: CommonAbstraJsonV14DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV14DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV14DefinitionsJobStageId
    schedule: CommonAbstraJsonV14DefinitionsJobStageSchedule

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["schedule"] = self.schedule
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsJobStage":
        return cls(
            transitions=[
                CommonAbstraJsonV14DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            schedule=str(data["schedule"]),
        )


CommonAbstraJsonV14JobsItem = CommonAbstraJsonV14DefinitionsJobStage

CommonAbstraJsonV14Jobs = typing.List[CommonAbstraJsonV14JobsItem]

CommonAbstraJsonV14DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV14DefinitionsTransition
)

CommonAbstraJsonV14DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV14DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV14DefinitionsHookStageFile = str

CommonAbstraJsonV14DefinitionsHookStageTitle = str

CommonAbstraJsonV14DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV14DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV14DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV14DefinitionsHookStageId = str

CommonAbstraJsonV14DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV14DefinitionsHookStagePath = str

CommonAbstraJsonV14DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV14DefinitionsHookStage:
    transitions: CommonAbstraJsonV14DefinitionsHookStageTransitions
    file: CommonAbstraJsonV14DefinitionsHookStageFile
    title: CommonAbstraJsonV14DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV14DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV14DefinitionsHookStageId
    is_initial: CommonAbstraJsonV14DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV14DefinitionsHookStagePath
    enabled: CommonAbstraJsonV14DefinitionsHookStageEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsHookStage":
        return cls(
            transitions=[
                CommonAbstraJsonV14DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV14HooksItem = CommonAbstraJsonV14DefinitionsHookStage

CommonAbstraJsonV14Hooks = typing.List[CommonAbstraJsonV14HooksItem]

CommonAbstraJsonV14DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV14DefinitionsTransition
)

CommonAbstraJsonV14DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV14DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV14DefinitionsFormStageFile = str

CommonAbstraJsonV14DefinitionsFormStageTitle = str

CommonAbstraJsonV14DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV14DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV14DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV14DefinitionsFormStageId = str

CommonAbstraJsonV14DefinitionsFormStageRestartButtonTextString = str

CommonAbstraJsonV14DefinitionsFormStageRestartButtonTextNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageRestartButtonText = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageRestartButtonTextString,
    CommonAbstraJsonV14DefinitionsFormStageRestartButtonTextNull,
]


def common_abstra_json_v14_definitions_form_stage_restart_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageRestartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageRestartButtonText from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV14DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV14DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v14_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV14DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV14DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v14_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV14DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV14DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v14_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV14DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV14DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV14DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV14DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV14DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV14DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV14DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV14DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV14DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV14DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v14_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV14DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV14DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v14_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageWelcomeTitleString = str

CommonAbstraJsonV14DefinitionsFormStageWelcomeTitleNull = type(None)

CommonAbstraJsonV14DefinitionsFormStageWelcomeTitle = typing.Union[
    CommonAbstraJsonV14DefinitionsFormStageWelcomeTitleString,
    CommonAbstraJsonV14DefinitionsFormStageWelcomeTitleNull,
]


def common_abstra_json_v14_definitions_form_stage_welcome_title_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV14DefinitionsFormStageWelcomeTitle":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV14DefinitionsFormStageWelcomeTitle from dict: {data}"
    )


CommonAbstraJsonV14DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV14DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV14DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV14DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV14DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV14DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV14DefinitionsFormStageAllowRestart = bool

CommonAbstraJsonV14DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV14DefinitionsFormStage:
    transitions: CommonAbstraJsonV14DefinitionsFormStageTransitions
    file: CommonAbstraJsonV14DefinitionsFormStageFile
    title: CommonAbstraJsonV14DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV14DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV14DefinitionsFormStageId
    restart_button_text: CommonAbstraJsonV14DefinitionsFormStageRestartButtonText
    start_button_text: CommonAbstraJsonV14DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV14DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV14DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV14DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV14DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV14DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV14DefinitionsFormStageErrorMessage
    welcome_title: CommonAbstraJsonV14DefinitionsFormStageWelcomeTitle
    notification_trigger: CommonAbstraJsonV14DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV14DefinitionsFormStageAutoStart
    allow_restart: CommonAbstraJsonV14DefinitionsFormStageAllowRestart
    path: CommonAbstraJsonV14DefinitionsFormStagePath

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["restart_button_text"] = self.restart_button_text
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["welcome_title"] = self.welcome_title
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["allow_restart"] = self.allow_restart
        data["path"] = self.path
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsFormStage":
        return cls(
            transitions=[
                CommonAbstraJsonV14DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            restart_button_text=(
                str(data["restart_button_text"])
                if isinstance(data["restart_button_text"], str)
                else None
            ),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV14DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            welcome_title=(
                str(data["welcome_title"])
                if isinstance(data["welcome_title"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV14DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            allow_restart=bool(data["allow_restart"]),
            path=str(data["path"]),
        )


CommonAbstraJsonV14FormsItem = CommonAbstraJsonV14DefinitionsFormStage

CommonAbstraJsonV14Forms = typing.List[CommonAbstraJsonV14FormsItem]

CommonAbstraJsonV14DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV14DefinitionsTransition
)

CommonAbstraJsonV14DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV14DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV14DefinitionsScriptStageFile = str

CommonAbstraJsonV14DefinitionsScriptStageTitle = str

CommonAbstraJsonV14DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV14DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV14DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV14DefinitionsScriptStageId = str

CommonAbstraJsonV14DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV14DefinitionsScriptStage:
    transitions: CommonAbstraJsonV14DefinitionsScriptStageTransitions
    file: CommonAbstraJsonV14DefinitionsScriptStageFile
    title: CommonAbstraJsonV14DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV14DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV14DefinitionsScriptStageId
    is_initial: CommonAbstraJsonV14DefinitionsScriptStageIsInitial

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV14DefinitionsScriptStage":
        return cls(
            transitions=[
                CommonAbstraJsonV14DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
        )


CommonAbstraJsonV14ScriptsItem = CommonAbstraJsonV14DefinitionsScriptStage

CommonAbstraJsonV14Scripts = typing.List[CommonAbstraJsonV14ScriptsItem]

CommonAbstraJsonV14Version = typing.Literal["14.0"]

CommonAbstraJsonV14VersionValues: typing.List[CommonAbstraJsonV14Version] = ["14.0"]


@dataclass
class CommonAbstraJsonV14:
    workspace: CommonAbstraJsonV14Workspace
    home: CommonAbstraJsonV14Home
    jobs: CommonAbstraJsonV14Jobs
    hooks: CommonAbstraJsonV14Hooks
    forms: CommonAbstraJsonV14Forms
    scripts: CommonAbstraJsonV14Scripts
    version: CommonAbstraJsonV14Version

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV14":
        return cls(
            workspace=CommonAbstraJsonV14Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV14Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV14DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV14DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV14DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV14DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            version=data["version"],
        )


CommonAbstraJsonV13WorkspaceName = str

CommonAbstraJsonV13WorkspaceLanguage = str

CommonAbstraJsonV13WorkspaceThemeString = str

CommonAbstraJsonV13WorkspaceThemeNull = type(None)

CommonAbstraJsonV13WorkspaceTheme = typing.Union[
    CommonAbstraJsonV13WorkspaceThemeString, CommonAbstraJsonV13WorkspaceThemeNull
]


def common_abstra_json_v13_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceLogoUrlString = str

CommonAbstraJsonV13WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV13WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV13WorkspaceLogoUrlString, CommonAbstraJsonV13WorkspaceLogoUrlNull
]


def common_abstra_json_v13_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceFaviconUrlString = str

CommonAbstraJsonV13WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV13WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV13WorkspaceFaviconUrlString,
    CommonAbstraJsonV13WorkspaceFaviconUrlNull,
]


def common_abstra_json_v13_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceBrandNameString = str

CommonAbstraJsonV13WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV13WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV13WorkspaceBrandNameString,
    CommonAbstraJsonV13WorkspaceBrandNameNull,
]


def common_abstra_json_v13_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceMainColorString = str

CommonAbstraJsonV13WorkspaceMainColorNull = type(None)

CommonAbstraJsonV13WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV13WorkspaceMainColorString,
    CommonAbstraJsonV13WorkspaceMainColorNull,
]


def common_abstra_json_v13_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceFontFamilyString = str

CommonAbstraJsonV13WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV13WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV13WorkspaceFontFamilyString,
    CommonAbstraJsonV13WorkspaceFontFamilyNull,
]


def common_abstra_json_v13_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV13WorkspaceFontColorString = str

CommonAbstraJsonV13WorkspaceFontColorNull = type(None)

CommonAbstraJsonV13WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV13WorkspaceFontColorString,
    CommonAbstraJsonV13WorkspaceFontColorNull,
]


def common_abstra_json_v13_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV13Workspace:
    name: CommonAbstraJsonV13WorkspaceName
    language: CommonAbstraJsonV13WorkspaceLanguage
    theme: CommonAbstraJsonV13WorkspaceTheme
    logo_url: CommonAbstraJsonV13WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV13WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV13WorkspaceBrandName
    main_color: CommonAbstraJsonV13WorkspaceMainColor
    font_family: CommonAbstraJsonV13WorkspaceFontFamily
    font_color: CommonAbstraJsonV13WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV13HomeAccessControlIsPublic = bool

CommonAbstraJsonV13HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV13HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV13HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV13HomeAccessControl:
    is_public: CommonAbstraJsonV13HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV13HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV13Home:
    access_control: CommonAbstraJsonV13HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV13Home":
        return cls(
            access_control=CommonAbstraJsonV13HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV13DefinitionsTransitionId = str

CommonAbstraJsonV13DefinitionsTransitionTargetId = str

CommonAbstraJsonV13DefinitionsTransitionTargetType = str

CommonAbstraJsonV13DefinitionsTransitionType = str

CommonAbstraJsonV13DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV13DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV13DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV13DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV13DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v13_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV13DefinitionsTransition:
    id: CommonAbstraJsonV13DefinitionsTransitionId
    target_id: CommonAbstraJsonV13DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV13DefinitionsTransitionTargetType
    type: CommonAbstraJsonV13DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV13DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV13DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV13DefinitionsTransition
)

CommonAbstraJsonV13DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV13DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV13DefinitionsJobStageFile = str

CommonAbstraJsonV13DefinitionsJobStageTitle = str

CommonAbstraJsonV13DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV13DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV13DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV13DefinitionsJobStageId = str

CommonAbstraJsonV13DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV13DefinitionsJobStage:
    transitions: CommonAbstraJsonV13DefinitionsJobStageTransitions
    file: CommonAbstraJsonV13DefinitionsJobStageFile
    title: CommonAbstraJsonV13DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV13DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV13DefinitionsJobStageId
    schedule: CommonAbstraJsonV13DefinitionsJobStageSchedule

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["schedule"] = self.schedule
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsJobStage":
        return cls(
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            schedule=str(data["schedule"]),
        )


CommonAbstraJsonV13JobsItem = CommonAbstraJsonV13DefinitionsJobStage

CommonAbstraJsonV13Jobs = typing.List[CommonAbstraJsonV13JobsItem]

CommonAbstraJsonV13DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV13DefinitionsTransition
)

CommonAbstraJsonV13DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV13DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV13DefinitionsHookStageFile = str

CommonAbstraJsonV13DefinitionsHookStageTitle = str

CommonAbstraJsonV13DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV13DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV13DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV13DefinitionsHookStageId = str

CommonAbstraJsonV13DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV13DefinitionsHookStagePath = str

CommonAbstraJsonV13DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV13DefinitionsHookStage:
    transitions: CommonAbstraJsonV13DefinitionsHookStageTransitions
    file: CommonAbstraJsonV13DefinitionsHookStageFile
    title: CommonAbstraJsonV13DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV13DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV13DefinitionsHookStageId
    is_initial: CommonAbstraJsonV13DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV13DefinitionsHookStagePath
    enabled: CommonAbstraJsonV13DefinitionsHookStageEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsHookStage":
        return cls(
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV13HooksItem = CommonAbstraJsonV13DefinitionsHookStage

CommonAbstraJsonV13Hooks = typing.List[CommonAbstraJsonV13HooksItem]

CommonAbstraJsonV13DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV13DefinitionsTransition
)

CommonAbstraJsonV13DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV13DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV13DefinitionsFormStageFile = str

CommonAbstraJsonV13DefinitionsFormStageTitle = str

CommonAbstraJsonV13DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV13DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV13DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV13DefinitionsFormStageId = str

CommonAbstraJsonV13DefinitionsFormStageRestartButtonTextString = str

CommonAbstraJsonV13DefinitionsFormStageRestartButtonTextNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageRestartButtonText = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageRestartButtonTextString,
    CommonAbstraJsonV13DefinitionsFormStageRestartButtonTextNull,
]


def common_abstra_json_v13_definitions_form_stage_restart_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageRestartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageRestartButtonText from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV13DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV13DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v13_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV13DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV13DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v13_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV13DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV13DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v13_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV13DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV13DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV13DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV13DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV13DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV13DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV13DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV13DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV13DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV13DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v13_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV13DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV13DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v13_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageWelcomeTitleString = str

CommonAbstraJsonV13DefinitionsFormStageWelcomeTitleNull = type(None)

CommonAbstraJsonV13DefinitionsFormStageWelcomeTitle = typing.Union[
    CommonAbstraJsonV13DefinitionsFormStageWelcomeTitleString,
    CommonAbstraJsonV13DefinitionsFormStageWelcomeTitleNull,
]


def common_abstra_json_v13_definitions_form_stage_welcome_title_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13DefinitionsFormStageWelcomeTitle":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13DefinitionsFormStageWelcomeTitle from dict: {data}"
    )


CommonAbstraJsonV13DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV13DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV13DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV13DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV13DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV13DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV13DefinitionsFormStageAllowRestart = bool

CommonAbstraJsonV13DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV13DefinitionsFormStage:
    transitions: CommonAbstraJsonV13DefinitionsFormStageTransitions
    file: CommonAbstraJsonV13DefinitionsFormStageFile
    title: CommonAbstraJsonV13DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV13DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV13DefinitionsFormStageId
    restart_button_text: CommonAbstraJsonV13DefinitionsFormStageRestartButtonText
    start_button_text: CommonAbstraJsonV13DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV13DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV13DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV13DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV13DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV13DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV13DefinitionsFormStageErrorMessage
    welcome_title: CommonAbstraJsonV13DefinitionsFormStageWelcomeTitle
    notification_trigger: CommonAbstraJsonV13DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV13DefinitionsFormStageAutoStart
    allow_restart: CommonAbstraJsonV13DefinitionsFormStageAllowRestart
    path: CommonAbstraJsonV13DefinitionsFormStagePath

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["restart_button_text"] = self.restart_button_text
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["welcome_title"] = self.welcome_title
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["allow_restart"] = self.allow_restart
        data["path"] = self.path
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsFormStage":
        return cls(
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            restart_button_text=(
                str(data["restart_button_text"])
                if isinstance(data["restart_button_text"], str)
                else None
            ),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV13DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            welcome_title=(
                str(data["welcome_title"])
                if isinstance(data["welcome_title"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV13DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            allow_restart=bool(data["allow_restart"]),
            path=str(data["path"]),
        )


CommonAbstraJsonV13FormsItem = CommonAbstraJsonV13DefinitionsFormStage

CommonAbstraJsonV13Forms = typing.List[CommonAbstraJsonV13FormsItem]

CommonAbstraJsonV13DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV13DefinitionsTransition
)

CommonAbstraJsonV13DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV13DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV13DefinitionsScriptStageFile = str

CommonAbstraJsonV13DefinitionsScriptStageTitle = str

CommonAbstraJsonV13DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV13DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV13DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV13DefinitionsScriptStageId = str

CommonAbstraJsonV13DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV13DefinitionsScriptStage:
    transitions: CommonAbstraJsonV13DefinitionsScriptStageTransitions
    file: CommonAbstraJsonV13DefinitionsScriptStageFile
    title: CommonAbstraJsonV13DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV13DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV13DefinitionsScriptStageId
    is_initial: CommonAbstraJsonV13DefinitionsScriptStageIsInitial

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13DefinitionsScriptStage":
        return cls(
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
        )


CommonAbstraJsonV13ScriptsItem = CommonAbstraJsonV13DefinitionsScriptStage

CommonAbstraJsonV13Scripts = typing.List[CommonAbstraJsonV13ScriptsItem]

CommonAbstraJsonV13AgentsItemId = str

CommonAbstraJsonV13AgentsItemTitle = str

CommonAbstraJsonV13AgentsItemProjectIdString = str

CommonAbstraJsonV13AgentsItemProjectIdNull = type(None)

CommonAbstraJsonV13AgentsItemProjectId = typing.Union[
    CommonAbstraJsonV13AgentsItemProjectIdString,
    CommonAbstraJsonV13AgentsItemProjectIdNull,
]


def common_abstra_json_v13_agents_item_project_id_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13AgentsItemProjectId":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13AgentsItemProjectId from dict: {data}"
    )


CommonAbstraJsonV13AgentsItemWorkflowPositionItem = float

CommonAbstraJsonV13AgentsItemWorkflowPosition = typing.List[
    CommonAbstraJsonV13AgentsItemWorkflowPositionItem
]

CommonAbstraJsonV13AgentsItemTransitionsItem = CommonAbstraJsonV13DefinitionsTransition

CommonAbstraJsonV13AgentsItemTransitions = typing.List[
    CommonAbstraJsonV13AgentsItemTransitionsItem
]

CommonAbstraJsonV13AgentsItemClientStageIdString = str

CommonAbstraJsonV13AgentsItemClientStageIdNull = type(None)

CommonAbstraJsonV13AgentsItemClientStageId = typing.Union[
    CommonAbstraJsonV13AgentsItemClientStageIdString,
    CommonAbstraJsonV13AgentsItemClientStageIdNull,
]


def common_abstra_json_v13_agents_item_client_stage_id_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV13AgentsItemClientStageId":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV13AgentsItemClientStageId from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV13AgentsItem:
    id: CommonAbstraJsonV13AgentsItemId
    title: CommonAbstraJsonV13AgentsItemTitle
    project_id: CommonAbstraJsonV13AgentsItemProjectId
    workflow_position: CommonAbstraJsonV13AgentsItemWorkflowPosition
    transitions: CommonAbstraJsonV13AgentsItemTransitions
    client_stage_id: CommonAbstraJsonV13AgentsItemClientStageId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["title"] = self.title
        data["project_id"] = self.project_id
        data["workflow_position"] = self.workflow_position
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["client_stage_id"] = self.client_stage_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13AgentsItem":
        return cls(
            id=str(data["id"]),
            title=str(data["title"]),
            project_id=(
                str(data["project_id"]) if isinstance(data["project_id"], str) else None
            ),
            workflow_position=[float(item) for item in data["workflow_position"]],
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            client_stage_id=(
                str(data["client_stage_id"])
                if isinstance(data["client_stage_id"], str)
                else None
            ),
        )


CommonAbstraJsonV13Agents = typing.List[CommonAbstraJsonV13AgentsItem]

CommonAbstraJsonV13ClientsItemId = str

CommonAbstraJsonV13ClientsItemTitle = str

CommonAbstraJsonV13ClientsItemWorkflowPositionItem = float

CommonAbstraJsonV13ClientsItemWorkflowPosition = typing.List[
    CommonAbstraJsonV13ClientsItemWorkflowPositionItem
]

CommonAbstraJsonV13ClientsItemTransitionsItem = CommonAbstraJsonV13DefinitionsTransition

CommonAbstraJsonV13ClientsItemTransitions = typing.List[
    CommonAbstraJsonV13ClientsItemTransitionsItem
]


@dataclass
class CommonAbstraJsonV13ClientsItem:
    id: CommonAbstraJsonV13ClientsItemId
    title: CommonAbstraJsonV13ClientsItemTitle
    workflow_position: CommonAbstraJsonV13ClientsItemWorkflowPosition
    transitions: CommonAbstraJsonV13ClientsItemTransitions

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["transitions"] = [item.to_dict() for item in self.transitions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV13ClientsItem":
        return cls(
            id=str(data["id"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            transitions=[
                CommonAbstraJsonV13DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
        )


CommonAbstraJsonV13Clients = typing.List[CommonAbstraJsonV13ClientsItem]

CommonAbstraJsonV13Version = typing.Literal["13.0"]

CommonAbstraJsonV13VersionValues: typing.List[CommonAbstraJsonV13Version] = ["13.0"]


@dataclass
class CommonAbstraJsonV13:
    workspace: CommonAbstraJsonV13Workspace
    home: CommonAbstraJsonV13Home
    jobs: CommonAbstraJsonV13Jobs
    hooks: CommonAbstraJsonV13Hooks
    forms: CommonAbstraJsonV13Forms
    scripts: CommonAbstraJsonV13Scripts
    agents: CommonAbstraJsonV13Agents
    clients: CommonAbstraJsonV13Clients
    version: CommonAbstraJsonV13Version

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["agents"] = [item.to_dict() for item in self.agents]
        data["clients"] = [item.to_dict() for item in self.clients]
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV13":
        return cls(
            workspace=CommonAbstraJsonV13Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV13Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV13DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV13DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV13DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV13DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            agents=[
                CommonAbstraJsonV13AgentsItem.from_dict(item) for item in data["agents"]
            ],
            clients=[
                CommonAbstraJsonV13ClientsItem.from_dict(item)
                for item in data["clients"]
            ],
            version=data["version"],
        )


CommonAbstraJsonV12WorkspaceName = str

CommonAbstraJsonV12WorkspaceLanguage = str

CommonAbstraJsonV12WorkspaceThemeString = str

CommonAbstraJsonV12WorkspaceThemeNull = type(None)

CommonAbstraJsonV12WorkspaceTheme = typing.Union[
    CommonAbstraJsonV12WorkspaceThemeString, CommonAbstraJsonV12WorkspaceThemeNull
]


def common_abstra_json_v12_workspace_theme_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceTheme":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceTheme from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceLogoUrlString = str

CommonAbstraJsonV12WorkspaceLogoUrlNull = type(None)

CommonAbstraJsonV12WorkspaceLogoUrl = typing.Union[
    CommonAbstraJsonV12WorkspaceLogoUrlString, CommonAbstraJsonV12WorkspaceLogoUrlNull
]


def common_abstra_json_v12_workspace_logo_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceLogoUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceLogoUrl from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceFaviconUrlString = str

CommonAbstraJsonV12WorkspaceFaviconUrlNull = type(None)

CommonAbstraJsonV12WorkspaceFaviconUrl = typing.Union[
    CommonAbstraJsonV12WorkspaceFaviconUrlString,
    CommonAbstraJsonV12WorkspaceFaviconUrlNull,
]


def common_abstra_json_v12_workspace_favicon_url_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceFaviconUrl":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceFaviconUrl from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceBrandNameString = str

CommonAbstraJsonV12WorkspaceBrandNameNull = type(None)

CommonAbstraJsonV12WorkspaceBrandName = typing.Union[
    CommonAbstraJsonV12WorkspaceBrandNameString,
    CommonAbstraJsonV12WorkspaceBrandNameNull,
]


def common_abstra_json_v12_workspace_brand_name_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceBrandName":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceBrandName from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceMainColorString = str

CommonAbstraJsonV12WorkspaceMainColorNull = type(None)

CommonAbstraJsonV12WorkspaceMainColor = typing.Union[
    CommonAbstraJsonV12WorkspaceMainColorString,
    CommonAbstraJsonV12WorkspaceMainColorNull,
]


def common_abstra_json_v12_workspace_main_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceMainColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceMainColor from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceFontFamilyString = str

CommonAbstraJsonV12WorkspaceFontFamilyNull = type(None)

CommonAbstraJsonV12WorkspaceFontFamily = typing.Union[
    CommonAbstraJsonV12WorkspaceFontFamilyString,
    CommonAbstraJsonV12WorkspaceFontFamilyNull,
]


def common_abstra_json_v12_workspace_font_family_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceFontFamily":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceFontFamily from dict: {data}"
    )


CommonAbstraJsonV12WorkspaceFontColorString = str

CommonAbstraJsonV12WorkspaceFontColorNull = type(None)

CommonAbstraJsonV12WorkspaceFontColor = typing.Union[
    CommonAbstraJsonV12WorkspaceFontColorString,
    CommonAbstraJsonV12WorkspaceFontColorNull,
]


def common_abstra_json_v12_workspace_font_color_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12WorkspaceFontColor":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12WorkspaceFontColor from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV12Workspace:
    name: CommonAbstraJsonV12WorkspaceName
    language: CommonAbstraJsonV12WorkspaceLanguage
    theme: CommonAbstraJsonV12WorkspaceTheme
    logo_url: CommonAbstraJsonV12WorkspaceLogoUrl
    favicon_url: CommonAbstraJsonV12WorkspaceFaviconUrl
    brand_name: CommonAbstraJsonV12WorkspaceBrandName
    main_color: CommonAbstraJsonV12WorkspaceMainColor
    font_family: CommonAbstraJsonV12WorkspaceFontFamily
    font_color: CommonAbstraJsonV12WorkspaceFontColor

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["language"] = self.language
        data["theme"] = self.theme
        data["logo_url"] = self.logo_url
        data["favicon_url"] = self.favicon_url
        data["brand_name"] = self.brand_name
        data["main_color"] = self.main_color
        data["font_family"] = self.font_family
        data["font_color"] = self.font_color
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12Workspace":
        return cls(
            name=str(data["name"]),
            language=str(data["language"]),
            theme=(str(data["theme"]) if isinstance(data["theme"], str) else None),
            logo_url=(
                str(data["logo_url"]) if isinstance(data["logo_url"], str) else None
            ),
            favicon_url=(
                str(data["favicon_url"])
                if isinstance(data["favicon_url"], str)
                else None
            ),
            brand_name=(
                str(data["brand_name"]) if isinstance(data["brand_name"], str) else None
            ),
            main_color=(
                str(data["main_color"]) if isinstance(data["main_color"], str) else None
            ),
            font_family=(
                str(data["font_family"])
                if isinstance(data["font_family"], str)
                else None
            ),
            font_color=(
                str(data["font_color"]) if isinstance(data["font_color"], str) else None
            ),
        )


CommonAbstraJsonV12HomeAccessControlIsPublic = bool

CommonAbstraJsonV12HomeAccessControlRequiredRolesItem = str

CommonAbstraJsonV12HomeAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV12HomeAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV12HomeAccessControl:
    is_public: CommonAbstraJsonV12HomeAccessControlIsPublic
    required_roles: CommonAbstraJsonV12HomeAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12HomeAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


@dataclass
class CommonAbstraJsonV12Home:
    access_control: CommonAbstraJsonV12HomeAccessControl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["access_control"] = self.access_control.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV12Home":
        return cls(
            access_control=CommonAbstraJsonV12HomeAccessControl.from_dict(
                data["access_control"]
            ),
        )


CommonAbstraJsonV12DefinitionsTransitionId = str

CommonAbstraJsonV12DefinitionsTransitionTargetId = str

CommonAbstraJsonV12DefinitionsTransitionTargetType = str

CommonAbstraJsonV12DefinitionsTransitionType = str

CommonAbstraJsonV12DefinitionsTransitionTaskTypeString = str

CommonAbstraJsonV12DefinitionsTransitionTaskTypeNull = type(None)

CommonAbstraJsonV12DefinitionsTransitionTaskType = typing.Union[
    CommonAbstraJsonV12DefinitionsTransitionTaskTypeString,
    CommonAbstraJsonV12DefinitionsTransitionTaskTypeNull,
]


def common_abstra_json_v12_definitions_transition_task_type_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsTransitionTaskType":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsTransitionTaskType from dict: {data}"
    )


@dataclass
class CommonAbstraJsonV12DefinitionsTransition:
    id: CommonAbstraJsonV12DefinitionsTransitionId
    target_id: CommonAbstraJsonV12DefinitionsTransitionTargetId
    target_type: CommonAbstraJsonV12DefinitionsTransitionTargetType
    type: CommonAbstraJsonV12DefinitionsTransitionType
    task_type: typing.Optional[CommonAbstraJsonV12DefinitionsTransitionTaskType] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["target_id"] = self.target_id
        data["target_type"] = self.target_type
        data["type"] = self.type
        if self.task_type is not None:
            data["task_type"] = self.task_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsTransition":
        return cls(
            id=str(data["id"]),
            target_id=str(data["target_id"]),
            target_type=str(data["target_type"]),
            type=str(data["type"]),
            task_type=None
            if data.get("task_type") is None
            else (
                str(data["task_type"]) if isinstance(data["task_type"], str) else None
            ),
        )


CommonAbstraJsonV12DefinitionsJobStageTransitionsItem = (
    CommonAbstraJsonV12DefinitionsTransition
)

CommonAbstraJsonV12DefinitionsJobStageTransitions = typing.List[
    CommonAbstraJsonV12DefinitionsJobStageTransitionsItem
]

CommonAbstraJsonV12DefinitionsJobStageFile = str

CommonAbstraJsonV12DefinitionsJobStageTitle = str

CommonAbstraJsonV12DefinitionsJobStageWorkflowPositionItem = float

CommonAbstraJsonV12DefinitionsJobStageWorkflowPosition = typing.List[
    CommonAbstraJsonV12DefinitionsJobStageWorkflowPositionItem
]

CommonAbstraJsonV12DefinitionsJobStageId = str

CommonAbstraJsonV12DefinitionsJobStageSchedule = str


@dataclass
class CommonAbstraJsonV12DefinitionsJobStage:
    transitions: CommonAbstraJsonV12DefinitionsJobStageTransitions
    file: CommonAbstraJsonV12DefinitionsJobStageFile
    title: CommonAbstraJsonV12DefinitionsJobStageTitle
    workflow_position: CommonAbstraJsonV12DefinitionsJobStageWorkflowPosition
    id: CommonAbstraJsonV12DefinitionsJobStageId
    schedule: CommonAbstraJsonV12DefinitionsJobStageSchedule

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["schedule"] = self.schedule
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsJobStage":
        return cls(
            transitions=[
                CommonAbstraJsonV12DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            schedule=str(data["schedule"]),
        )


CommonAbstraJsonV12JobsItem = CommonAbstraJsonV12DefinitionsJobStage

CommonAbstraJsonV12Jobs = typing.List[CommonAbstraJsonV12JobsItem]

CommonAbstraJsonV12DefinitionsHookStageTransitionsItem = (
    CommonAbstraJsonV12DefinitionsTransition
)

CommonAbstraJsonV12DefinitionsHookStageTransitions = typing.List[
    CommonAbstraJsonV12DefinitionsHookStageTransitionsItem
]

CommonAbstraJsonV12DefinitionsHookStageFile = str

CommonAbstraJsonV12DefinitionsHookStageTitle = str

CommonAbstraJsonV12DefinitionsHookStageWorkflowPositionItem = float

CommonAbstraJsonV12DefinitionsHookStageWorkflowPosition = typing.List[
    CommonAbstraJsonV12DefinitionsHookStageWorkflowPositionItem
]

CommonAbstraJsonV12DefinitionsHookStageId = str

CommonAbstraJsonV12DefinitionsHookStageIsInitial = bool

CommonAbstraJsonV12DefinitionsHookStagePath = str

CommonAbstraJsonV12DefinitionsHookStageEnabled = bool


@dataclass
class CommonAbstraJsonV12DefinitionsHookStage:
    transitions: CommonAbstraJsonV12DefinitionsHookStageTransitions
    file: CommonAbstraJsonV12DefinitionsHookStageFile
    title: CommonAbstraJsonV12DefinitionsHookStageTitle
    workflow_position: CommonAbstraJsonV12DefinitionsHookStageWorkflowPosition
    id: CommonAbstraJsonV12DefinitionsHookStageId
    is_initial: CommonAbstraJsonV12DefinitionsHookStageIsInitial
    path: CommonAbstraJsonV12DefinitionsHookStagePath
    enabled: CommonAbstraJsonV12DefinitionsHookStageEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        data["path"] = self.path
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsHookStage":
        return cls(
            transitions=[
                CommonAbstraJsonV12DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
            path=str(data["path"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV12HooksItem = CommonAbstraJsonV12DefinitionsHookStage

CommonAbstraJsonV12Hooks = typing.List[CommonAbstraJsonV12HooksItem]

CommonAbstraJsonV12DefinitionsFormStageTransitionsItem = (
    CommonAbstraJsonV12DefinitionsTransition
)

CommonAbstraJsonV12DefinitionsFormStageTransitions = typing.List[
    CommonAbstraJsonV12DefinitionsFormStageTransitionsItem
]

CommonAbstraJsonV12DefinitionsFormStageFile = str

CommonAbstraJsonV12DefinitionsFormStageTitle = str

CommonAbstraJsonV12DefinitionsFormStageWorkflowPositionItem = float

CommonAbstraJsonV12DefinitionsFormStageWorkflowPosition = typing.List[
    CommonAbstraJsonV12DefinitionsFormStageWorkflowPositionItem
]

CommonAbstraJsonV12DefinitionsFormStageId = str

CommonAbstraJsonV12DefinitionsFormStageRestartButtonTextString = str

CommonAbstraJsonV12DefinitionsFormStageRestartButtonTextNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageRestartButtonText = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageRestartButtonTextString,
    CommonAbstraJsonV12DefinitionsFormStageRestartButtonTextNull,
]


def common_abstra_json_v12_definitions_form_stage_restart_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageRestartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageRestartButtonText from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageStartButtonTextString = str

CommonAbstraJsonV12DefinitionsFormStageStartButtonTextNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageStartButtonText = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageStartButtonTextString,
    CommonAbstraJsonV12DefinitionsFormStageStartButtonTextNull,
]


def common_abstra_json_v12_definitions_form_stage_start_button_text_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageStartButtonText":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageStartButtonText from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageEndMessageString = str

CommonAbstraJsonV12DefinitionsFormStageEndMessageNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageEndMessage = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageEndMessageString,
    CommonAbstraJsonV12DefinitionsFormStageEndMessageNull,
]


def common_abstra_json_v12_definitions_form_stage_end_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageEndMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageEndMessage from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageStartMessageString = str

CommonAbstraJsonV12DefinitionsFormStageStartMessageNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageStartMessage = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageStartMessageString,
    CommonAbstraJsonV12DefinitionsFormStageStartMessageNull,
]


def common_abstra_json_v12_definitions_form_stage_start_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageStartMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageStartMessage from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageIsInitial = bool

CommonAbstraJsonV12DefinitionsFormStageAccessControlIsPublic = bool

CommonAbstraJsonV12DefinitionsFormStageAccessControlRequiredRolesItem = str

CommonAbstraJsonV12DefinitionsFormStageAccessControlRequiredRoles = typing.List[
    CommonAbstraJsonV12DefinitionsFormStageAccessControlRequiredRolesItem
]


@dataclass
class CommonAbstraJsonV12DefinitionsFormStageAccessControl:
    is_public: CommonAbstraJsonV12DefinitionsFormStageAccessControlIsPublic
    required_roles: CommonAbstraJsonV12DefinitionsFormStageAccessControlRequiredRoles

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["is_public"] = self.is_public
        data["required_roles"] = self.required_roles
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsFormStageAccessControl":
        return cls(
            is_public=bool(data["is_public"]),
            required_roles=[str(item) for item in data["required_roles"]],
        )


CommonAbstraJsonV12DefinitionsFormStageTimeoutMessageString = str

CommonAbstraJsonV12DefinitionsFormStageTimeoutMessageNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageTimeoutMessage = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageTimeoutMessageString,
    CommonAbstraJsonV12DefinitionsFormStageTimeoutMessageNull,
]


def common_abstra_json_v12_definitions_form_stage_timeout_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageTimeoutMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageTimeoutMessage from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageErrorMessageString = str

CommonAbstraJsonV12DefinitionsFormStageErrorMessageNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageErrorMessage = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageErrorMessageString,
    CommonAbstraJsonV12DefinitionsFormStageErrorMessageNull,
]


def common_abstra_json_v12_definitions_form_stage_error_message_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageErrorMessage":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageErrorMessage from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageWelcomeTitleString = str

CommonAbstraJsonV12DefinitionsFormStageWelcomeTitleNull = type(None)

CommonAbstraJsonV12DefinitionsFormStageWelcomeTitle = typing.Union[
    CommonAbstraJsonV12DefinitionsFormStageWelcomeTitleString,
    CommonAbstraJsonV12DefinitionsFormStageWelcomeTitleNull,
]


def common_abstra_json_v12_definitions_form_stage_welcome_title_from_dict(
    data: typing.Any,
) -> "CommonAbstraJsonV12DefinitionsFormStageWelcomeTitle":
    if isinstance(data, str):
        return str(data)
    if data is None:
        return None
    raise ValueError(
        f"Could not parse CommonAbstraJsonV12DefinitionsFormStageWelcomeTitle from dict: {data}"
    )


CommonAbstraJsonV12DefinitionsFormStageNotificationTriggerVariableName = str

CommonAbstraJsonV12DefinitionsFormStageNotificationTriggerEnabled = bool


@dataclass
class CommonAbstraJsonV12DefinitionsFormStageNotificationTrigger:
    variable_name: (
        CommonAbstraJsonV12DefinitionsFormStageNotificationTriggerVariableName
    )
    enabled: CommonAbstraJsonV12DefinitionsFormStageNotificationTriggerEnabled

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["variable_name"] = self.variable_name
        data["enabled"] = self.enabled
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsFormStageNotificationTrigger":
        return cls(
            variable_name=str(data["variable_name"]),
            enabled=bool(data["enabled"]),
        )


CommonAbstraJsonV12DefinitionsFormStageAutoStart = bool

CommonAbstraJsonV12DefinitionsFormStageAllowRestart = bool

CommonAbstraJsonV12DefinitionsFormStagePath = str


@dataclass
class CommonAbstraJsonV12DefinitionsFormStage:
    transitions: CommonAbstraJsonV12DefinitionsFormStageTransitions
    file: CommonAbstraJsonV12DefinitionsFormStageFile
    title: CommonAbstraJsonV12DefinitionsFormStageTitle
    workflow_position: CommonAbstraJsonV12DefinitionsFormStageWorkflowPosition
    id: CommonAbstraJsonV12DefinitionsFormStageId
    restart_button_text: CommonAbstraJsonV12DefinitionsFormStageRestartButtonText
    start_button_text: CommonAbstraJsonV12DefinitionsFormStageStartButtonText
    end_message: CommonAbstraJsonV12DefinitionsFormStageEndMessage
    start_message: CommonAbstraJsonV12DefinitionsFormStageStartMessage
    is_initial: CommonAbstraJsonV12DefinitionsFormStageIsInitial
    access_control: CommonAbstraJsonV12DefinitionsFormStageAccessControl
    timeout_message: CommonAbstraJsonV12DefinitionsFormStageTimeoutMessage
    error_message: CommonAbstraJsonV12DefinitionsFormStageErrorMessage
    welcome_title: CommonAbstraJsonV12DefinitionsFormStageWelcomeTitle
    notification_trigger: CommonAbstraJsonV12DefinitionsFormStageNotificationTrigger
    auto_start: CommonAbstraJsonV12DefinitionsFormStageAutoStart
    allow_restart: CommonAbstraJsonV12DefinitionsFormStageAllowRestart
    path: CommonAbstraJsonV12DefinitionsFormStagePath

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["restart_button_text"] = self.restart_button_text
        data["start_button_text"] = self.start_button_text
        data["end_message"] = self.end_message
        data["start_message"] = self.start_message
        data["is_initial"] = self.is_initial
        data["access_control"] = self.access_control.to_dict()
        data["timeout_message"] = self.timeout_message
        data["error_message"] = self.error_message
        data["welcome_title"] = self.welcome_title
        data["notification_trigger"] = self.notification_trigger.to_dict()
        data["auto_start"] = self.auto_start
        data["allow_restart"] = self.allow_restart
        data["path"] = self.path
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsFormStage":
        return cls(
            transitions=[
                CommonAbstraJsonV12DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            restart_button_text=(
                str(data["restart_button_text"])
                if isinstance(data["restart_button_text"], str)
                else None
            ),
            start_button_text=(
                str(data["start_button_text"])
                if isinstance(data["start_button_text"], str)
                else None
            ),
            end_message=(
                str(data["end_message"])
                if isinstance(data["end_message"], str)
                else None
            ),
            start_message=(
                str(data["start_message"])
                if isinstance(data["start_message"], str)
                else None
            ),
            is_initial=bool(data["is_initial"]),
            access_control=CommonAbstraJsonV12DefinitionsFormStageAccessControl.from_dict(
                data["access_control"]
            ),
            timeout_message=(
                str(data["timeout_message"])
                if isinstance(data["timeout_message"], str)
                else None
            ),
            error_message=(
                str(data["error_message"])
                if isinstance(data["error_message"], str)
                else None
            ),
            welcome_title=(
                str(data["welcome_title"])
                if isinstance(data["welcome_title"], str)
                else None
            ),
            notification_trigger=CommonAbstraJsonV12DefinitionsFormStageNotificationTrigger.from_dict(
                data["notification_trigger"]
            ),
            auto_start=bool(data["auto_start"]),
            allow_restart=bool(data["allow_restart"]),
            path=str(data["path"]),
        )


CommonAbstraJsonV12FormsItem = CommonAbstraJsonV12DefinitionsFormStage

CommonAbstraJsonV12Forms = typing.List[CommonAbstraJsonV12FormsItem]

CommonAbstraJsonV12DefinitionsScriptStageTransitionsItem = (
    CommonAbstraJsonV12DefinitionsTransition
)

CommonAbstraJsonV12DefinitionsScriptStageTransitions = typing.List[
    CommonAbstraJsonV12DefinitionsScriptStageTransitionsItem
]

CommonAbstraJsonV12DefinitionsScriptStageFile = str

CommonAbstraJsonV12DefinitionsScriptStageTitle = str

CommonAbstraJsonV12DefinitionsScriptStageWorkflowPositionItem = float

CommonAbstraJsonV12DefinitionsScriptStageWorkflowPosition = typing.List[
    CommonAbstraJsonV12DefinitionsScriptStageWorkflowPositionItem
]

CommonAbstraJsonV12DefinitionsScriptStageId = str

CommonAbstraJsonV12DefinitionsScriptStageIsInitial = bool


@dataclass
class CommonAbstraJsonV12DefinitionsScriptStage:
    transitions: CommonAbstraJsonV12DefinitionsScriptStageTransitions
    file: CommonAbstraJsonV12DefinitionsScriptStageFile
    title: CommonAbstraJsonV12DefinitionsScriptStageTitle
    workflow_position: CommonAbstraJsonV12DefinitionsScriptStageWorkflowPosition
    id: CommonAbstraJsonV12DefinitionsScriptStageId
    is_initial: CommonAbstraJsonV12DefinitionsScriptStageIsInitial

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["transitions"] = [item.to_dict() for item in self.transitions]
        data["file"] = self.file
        data["title"] = self.title
        data["workflow_position"] = self.workflow_position
        data["id"] = self.id
        data["is_initial"] = self.is_initial
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAbstraJsonV12DefinitionsScriptStage":
        return cls(
            transitions=[
                CommonAbstraJsonV12DefinitionsTransition.from_dict(item)
                for item in data["transitions"]
            ],
            file=str(data["file"]),
            title=str(data["title"]),
            workflow_position=[float(item) for item in data["workflow_position"]],
            id=str(data["id"]),
            is_initial=bool(data["is_initial"]),
        )


CommonAbstraJsonV12ScriptsItem = CommonAbstraJsonV12DefinitionsScriptStage

CommonAbstraJsonV12Scripts = typing.List[CommonAbstraJsonV12ScriptsItem]

CommonAbstraJsonV12Version = typing.Literal["12.0"]

CommonAbstraJsonV12VersionValues: typing.List[CommonAbstraJsonV12Version] = ["12.0"]


@dataclass
class CommonAbstraJsonV12:
    workspace: CommonAbstraJsonV12Workspace
    home: CommonAbstraJsonV12Home
    jobs: CommonAbstraJsonV12Jobs
    hooks: CommonAbstraJsonV12Hooks
    forms: CommonAbstraJsonV12Forms
    scripts: CommonAbstraJsonV12Scripts
    version: CommonAbstraJsonV12Version

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["workspace"] = self.workspace.to_dict()
        data["home"] = self.home.to_dict()
        data["jobs"] = [item.to_dict() for item in self.jobs]
        data["hooks"] = [item.to_dict() for item in self.hooks]
        data["forms"] = [item.to_dict() for item in self.forms]
        data["scripts"] = [item.to_dict() for item in self.scripts]
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonAbstraJsonV12":
        return cls(
            workspace=CommonAbstraJsonV12Workspace.from_dict(data["workspace"]),
            home=CommonAbstraJsonV12Home.from_dict(data["home"]),
            jobs=[
                CommonAbstraJsonV12DefinitionsJobStage.from_dict(item)
                for item in data["jobs"]
            ],
            hooks=[
                CommonAbstraJsonV12DefinitionsHookStage.from_dict(item)
                for item in data["hooks"]
            ],
            forms=[
                CommonAbstraJsonV12DefinitionsFormStage.from_dict(item)
                for item in data["forms"]
            ],
            scripts=[
                CommonAbstraJsonV12DefinitionsScriptStage.from_dict(item)
                for item in data["scripts"]
            ],
            version=data["version"],
        )


CommonAiDestructiveTool = typing.Union[
    typing.Literal["delete_table"],
    typing.Literal["delete_column_by_id"],
    typing.Literal["delete_table_rows"],
    typing.Literal["delete_stage"],
    typing.Literal["remove_role"],
    typing.Literal["execute_connection_action"],
]

CommonAiDestructiveToolValues: typing.List[CommonAiDestructiveTool] = [
    "delete_table",
    "delete_column_by_id",
    "delete_table_rows",
    "delete_stage",
    "remove_role",
    "execute_connection_action",
]

CommonDeploymentResourcesOrganizationDeploymentResourcesWatermarkEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonDeploymentResourcesOrganizationDeploymentResourcesWatermarkEnabledValues: typing.List[
    CommonDeploymentResourcesOrganizationDeploymentResourcesWatermarkEnabled
] = ["true", "false"]

CommonDeploymentResourcesOrganizationDeploymentResourcesNativeTempDir = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonDeploymentResourcesOrganizationDeploymentResourcesNativeTempDirValues: typing.List[
    CommonDeploymentResourcesOrganizationDeploymentResourcesNativeTempDir
] = ["true", "false"]

CommonDeploymentResourcesOrganizationDeploymentResourcesNotificationsEnabled = (
    typing.Union[typing.Literal["true"], typing.Literal["false"]]
)

CommonDeploymentResourcesOrganizationDeploymentResourcesNotificationsEnabledValues: typing.List[
    CommonDeploymentResourcesOrganizationDeploymentResourcesNotificationsEnabled
] = ["true", "false"]

CommonDeploymentResourcesOrganizationDeploymentResourcesUseCloudApiPlayer = (
    typing.Union[typing.Literal["true"], typing.Literal["false"]]
)

CommonDeploymentResourcesOrganizationDeploymentResourcesUseCloudApiPlayerValues: typing.List[
    CommonDeploymentResourcesOrganizationDeploymentResourcesUseCloudApiPlayer
] = ["true", "false"]

CommonDeploymentResourcesOrganizationDeploymentResourcesRequestsCPU = str

CommonDeploymentResourcesOrganizationDeploymentResourcesLimitsCPU = str

CommonDeploymentResourcesOrganizationDeploymentResourcesRequestsMemory = str

CommonDeploymentResourcesOrganizationDeploymentResourcesLimitsMemory = str

CommonDeploymentResourcesOrganizationDeploymentResourcesMinReplicas = str

CommonDeploymentResourcesOrganizationDeploymentResourcesComputeUnits = float

CommonDeploymentResourcesOrganizationDeploymentResourcesServerComputeUnits = float

CommonDeploymentResourcesOrganizationDeploymentResourcesTimeoutSeconds = str

CommonDeploymentResourcesOrganizationDeploymentResourcesWorkerType = str

CommonDeploymentResourcesOrganizationDeploymentResourcesPythonVersion = typing.Union[
    typing.Literal["3.9"],
    typing.Literal["3.10"],
    typing.Literal["3.11"],
    typing.Literal["3.12"],
]

CommonDeploymentResourcesOrganizationDeploymentResourcesPythonVersionValues: typing.List[
    CommonDeploymentResourcesOrganizationDeploymentResourcesPythonVersion
] = ["3.9", "3.10", "3.11", "3.12"]

CommonDeploymentResourcesOrganizationDeploymentResourcesWorkerNumber = str

CommonDeploymentResourcesOrganizationDeploymentResourcesBaseDockerfile = str

CommonDeploymentResourcesOrganizationDeploymentResourcesQueueMessagesPerWorker = str

CommonDeploymentResourcesOrganizationDeploymentResourcesAutoscaleMinWorker = str

CommonDeploymentResourcesOrganizationDeploymentResourcesAutoscaleMaxWorker = str

CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorPoolSize = str

CommonDeploymentResourcesOrganizationDeploymentResourcesMinFormsExecutors = str

CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorMaxExecutions = str

CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorWarmupParallelism = str


@dataclass
class CommonDeploymentResourcesOrganizationDeploymentResources:
    watermark_enabled: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesWatermarkEnabled
    ] = field(default_factory=lambda: None)
    native_temp_dir: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesNativeTempDir
    ] = field(default_factory=lambda: None)
    notifications_enabled: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesNotificationsEnabled
    ] = field(default_factory=lambda: None)
    use_cloud_api_player: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesUseCloudApiPlayer
    ] = field(default_factory=lambda: None)
    requests_c_p_u: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesRequestsCPU
    ] = field(default_factory=lambda: None)
    limits_c_p_u: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesLimitsCPU
    ] = field(default_factory=lambda: None)
    requests_memory: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesRequestsMemory
    ] = field(default_factory=lambda: None)
    limits_memory: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesLimitsMemory
    ] = field(default_factory=lambda: None)
    min_replicas: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesMinReplicas
    ] = field(default_factory=lambda: None)
    compute_units: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesComputeUnits
    ] = field(default_factory=lambda: None)
    server_compute_units: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesServerComputeUnits
    ] = field(default_factory=lambda: None)
    timeout_seconds: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesTimeoutSeconds
    ] = field(default_factory=lambda: None)
    worker_type: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesWorkerType
    ] = field(default_factory=lambda: None)
    python_version: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesPythonVersion
    ] = field(default_factory=lambda: None)
    worker_number: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesWorkerNumber
    ] = field(default_factory=lambda: None)
    base_dockerfile: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesBaseDockerfile
    ] = field(default_factory=lambda: None)
    queue_messages_per_worker: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesQueueMessagesPerWorker
    ] = field(default_factory=lambda: None)
    autoscale_min_worker: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesAutoscaleMinWorker
    ] = field(default_factory=lambda: None)
    autoscale_max_worker: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesAutoscaleMaxWorker
    ] = field(default_factory=lambda: None)
    executor_pool_size: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorPoolSize
    ] = field(default_factory=lambda: None)
    min_forms_executors: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesMinFormsExecutors
    ] = field(default_factory=lambda: None)
    executor_max_executions: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorMaxExecutions
    ] = field(default_factory=lambda: None)
    executor_warmup_parallelism: typing.Optional[
        CommonDeploymentResourcesOrganizationDeploymentResourcesExecutorWarmupParallelism
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.watermark_enabled is not None:
            data["watermarkEnabled"] = self.watermark_enabled
        if self.native_temp_dir is not None:
            data["nativeTempDir"] = self.native_temp_dir
        if self.notifications_enabled is not None:
            data["notificationsEnabled"] = self.notifications_enabled
        if self.use_cloud_api_player is not None:
            data["useCloudApiPlayer"] = self.use_cloud_api_player
        if self.requests_c_p_u is not None:
            data["requestsCPU"] = self.requests_c_p_u
        if self.limits_c_p_u is not None:
            data["limitsCPU"] = self.limits_c_p_u
        if self.requests_memory is not None:
            data["requestsMemory"] = self.requests_memory
        if self.limits_memory is not None:
            data["limitsMemory"] = self.limits_memory
        if self.min_replicas is not None:
            data["minReplicas"] = self.min_replicas
        if self.compute_units is not None:
            data["computeUnits"] = self.compute_units
        if self.server_compute_units is not None:
            data["serverComputeUnits"] = self.server_compute_units
        if self.timeout_seconds is not None:
            data["timeoutSeconds"] = self.timeout_seconds
        if self.worker_type is not None:
            data["workerType"] = self.worker_type
        if self.python_version is not None:
            data["pythonVersion"] = self.python_version
        if self.worker_number is not None:
            data["workerNumber"] = self.worker_number
        if self.base_dockerfile is not None:
            data["baseDockerfile"] = self.base_dockerfile
        if self.queue_messages_per_worker is not None:
            data["queueMessagesPerWorker"] = self.queue_messages_per_worker
        if self.autoscale_min_worker is not None:
            data["autoscaleMinWorker"] = self.autoscale_min_worker
        if self.autoscale_max_worker is not None:
            data["autoscaleMaxWorker"] = self.autoscale_max_worker
        if self.executor_pool_size is not None:
            data["executorPoolSize"] = self.executor_pool_size
        if self.min_forms_executors is not None:
            data["minFormsExecutors"] = self.min_forms_executors
        if self.executor_max_executions is not None:
            data["executorMaxExecutions"] = self.executor_max_executions
        if self.executor_warmup_parallelism is not None:
            data["executorWarmupParallelism"] = self.executor_warmup_parallelism
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonDeploymentResourcesOrganizationDeploymentResources":
        return cls(
            watermark_enabled=None
            if data.get("watermarkEnabled") is None
            else data["watermarkEnabled"],
            native_temp_dir=None
            if data.get("nativeTempDir") is None
            else data["nativeTempDir"],
            notifications_enabled=None
            if data.get("notificationsEnabled") is None
            else data["notificationsEnabled"],
            use_cloud_api_player=None
            if data.get("useCloudApiPlayer") is None
            else data["useCloudApiPlayer"],
            requests_c_p_u=None
            if data.get("requestsCPU") is None
            else str(data["requestsCPU"]),
            limits_c_p_u=None
            if data.get("limitsCPU") is None
            else str(data["limitsCPU"]),
            requests_memory=None
            if data.get("requestsMemory") is None
            else str(data["requestsMemory"]),
            limits_memory=None
            if data.get("limitsMemory") is None
            else str(data["limitsMemory"]),
            min_replicas=None
            if data.get("minReplicas") is None
            else str(data["minReplicas"]),
            compute_units=None
            if data.get("computeUnits") is None
            else float(data["computeUnits"]),
            server_compute_units=None
            if data.get("serverComputeUnits") is None
            else float(data["serverComputeUnits"]),
            timeout_seconds=None
            if data.get("timeoutSeconds") is None
            else str(data["timeoutSeconds"]),
            worker_type=None
            if data.get("workerType") is None
            else str(data["workerType"]),
            python_version=None
            if data.get("pythonVersion") is None
            else data["pythonVersion"],
            worker_number=None
            if data.get("workerNumber") is None
            else str(data["workerNumber"]),
            base_dockerfile=None
            if data.get("baseDockerfile") is None
            else str(data["baseDockerfile"]),
            queue_messages_per_worker=None
            if data.get("queueMessagesPerWorker") is None
            else str(data["queueMessagesPerWorker"]),
            autoscale_min_worker=None
            if data.get("autoscaleMinWorker") is None
            else str(data["autoscaleMinWorker"]),
            autoscale_max_worker=None
            if data.get("autoscaleMaxWorker") is None
            else str(data["autoscaleMaxWorker"]),
            executor_pool_size=None
            if data.get("executorPoolSize") is None
            else str(data["executorPoolSize"]),
            min_forms_executors=None
            if data.get("minFormsExecutors") is None
            else str(data["minFormsExecutors"]),
            executor_max_executions=None
            if data.get("executorMaxExecutions") is None
            else str(data["executorMaxExecutions"]),
            executor_warmup_parallelism=None
            if data.get("executorWarmupParallelism") is None
            else str(data["executorWarmupParallelism"]),
        )


CommonDeploymentResourcesProjectDeploymentResourcesWatermarkEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonDeploymentResourcesProjectDeploymentResourcesWatermarkEnabledValues: typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesWatermarkEnabled
] = ["true", "false"]

CommonDeploymentResourcesProjectDeploymentResourcesSeleniumInstanceEnabled = (
    typing.Union[typing.Literal["true"], typing.Literal["false"]]
)

CommonDeploymentResourcesProjectDeploymentResourcesSeleniumInstanceEnabledValues: typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesSeleniumInstanceEnabled
] = ["true", "false"]

CommonDeploymentResourcesProjectDeploymentResourcesUseCloudApiPlayer = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonDeploymentResourcesProjectDeploymentResourcesUseCloudApiPlayerValues: typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesUseCloudApiPlayer
] = ["true", "false"]

CommonDeploymentResourcesProjectDeploymentResourcesNotificationsEnabled = typing.Union[
    typing.Literal["true"], typing.Literal["false"]
]

CommonDeploymentResourcesProjectDeploymentResourcesNotificationsEnabledValues: typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesNotificationsEnabled
] = ["true", "false"]

CommonDeploymentResourcesProjectDeploymentResourcesRequestsCPU = str

CommonDeploymentResourcesProjectDeploymentResourcesLimitsCPU = str

CommonDeploymentResourcesProjectDeploymentResourcesRequestsMemory = str

CommonDeploymentResourcesProjectDeploymentResourcesLimitsMemory = str

CommonDeploymentResourcesProjectDeploymentResourcesMinReplicas = str

CommonDeploymentResourcesProjectDeploymentResourcesComputeUnits = float

CommonDeploymentResourcesProjectDeploymentResourcesServerComputeUnits = float

CommonDeploymentResourcesProjectDeploymentResourcesTimeoutSeconds = str

CommonDeploymentResourcesProjectDeploymentResourcesWorkerType = str

CommonDeploymentResourcesProjectDeploymentResourcesPythonVersion = typing.Union[
    typing.Literal["3.9"],
    typing.Literal["3.10"],
    typing.Literal["3.11"],
    typing.Literal["3.12"],
]

CommonDeploymentResourcesProjectDeploymentResourcesPythonVersionValues: typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesPythonVersion
] = ["3.9", "3.10", "3.11", "3.12"]

CommonDeploymentResourcesProjectDeploymentResourcesWorkerNumber = str

CommonDeploymentResourcesProjectDeploymentResourcesBaseDockerfile = str

CommonDeploymentResourcesProjectDeploymentResourcesQueueMessagesPerWorker = str

CommonDeploymentResourcesProjectDeploymentResourcesAutoscaleMinWorker = str

CommonDeploymentResourcesProjectDeploymentResourcesAutoscaleMaxWorker = str

CommonDeploymentResourcesProjectDeploymentResourcesWhitelistIpsItem = str

CommonDeploymentResourcesProjectDeploymentResourcesWhitelistIps = typing.List[
    CommonDeploymentResourcesProjectDeploymentResourcesWhitelistIpsItem
]

CommonDeploymentResourcesProjectDeploymentResourcesExecutorPoolSize = str

CommonDeploymentResourcesProjectDeploymentResourcesMinFormsExecutors = str

CommonDeploymentResourcesProjectDeploymentResourcesExecutorMaxExecutions = str

CommonDeploymentResourcesProjectDeploymentResourcesExecutorWarmupParallelism = str


@dataclass
class CommonDeploymentResourcesProjectDeploymentResources:
    watermark_enabled: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesWatermarkEnabled
    ] = field(default_factory=lambda: None)
    selenium_instance_enabled: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesSeleniumInstanceEnabled
    ] = field(default_factory=lambda: None)
    use_cloud_api_player: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesUseCloudApiPlayer
    ] = field(default_factory=lambda: None)
    notifications_enabled: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesNotificationsEnabled
    ] = field(default_factory=lambda: None)
    requests_c_p_u: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesRequestsCPU
    ] = field(default_factory=lambda: None)
    limits_c_p_u: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesLimitsCPU
    ] = field(default_factory=lambda: None)
    requests_memory: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesRequestsMemory
    ] = field(default_factory=lambda: None)
    limits_memory: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesLimitsMemory
    ] = field(default_factory=lambda: None)
    min_replicas: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesMinReplicas
    ] = field(default_factory=lambda: None)
    compute_units: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesComputeUnits
    ] = field(default_factory=lambda: None)
    server_compute_units: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesServerComputeUnits
    ] = field(default_factory=lambda: None)
    timeout_seconds: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesTimeoutSeconds
    ] = field(default_factory=lambda: None)
    worker_type: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesWorkerType
    ] = field(default_factory=lambda: None)
    python_version: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesPythonVersion
    ] = field(default_factory=lambda: None)
    worker_number: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesWorkerNumber
    ] = field(default_factory=lambda: None)
    base_dockerfile: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesBaseDockerfile
    ] = field(default_factory=lambda: None)
    queue_messages_per_worker: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesQueueMessagesPerWorker
    ] = field(default_factory=lambda: None)
    autoscale_min_worker: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesAutoscaleMinWorker
    ] = field(default_factory=lambda: None)
    autoscale_max_worker: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesAutoscaleMaxWorker
    ] = field(default_factory=lambda: None)
    whitelist_ips: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesWhitelistIps
    ] = field(default_factory=lambda: None)
    executor_pool_size: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesExecutorPoolSize
    ] = field(default_factory=lambda: None)
    min_forms_executors: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesMinFormsExecutors
    ] = field(default_factory=lambda: None)
    executor_max_executions: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesExecutorMaxExecutions
    ] = field(default_factory=lambda: None)
    executor_warmup_parallelism: typing.Optional[
        CommonDeploymentResourcesProjectDeploymentResourcesExecutorWarmupParallelism
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.watermark_enabled is not None:
            data["watermarkEnabled"] = self.watermark_enabled
        if self.selenium_instance_enabled is not None:
            data["seleniumInstanceEnabled"] = self.selenium_instance_enabled
        if self.use_cloud_api_player is not None:
            data["useCloudApiPlayer"] = self.use_cloud_api_player
        if self.notifications_enabled is not None:
            data["notificationsEnabled"] = self.notifications_enabled
        if self.requests_c_p_u is not None:
            data["requestsCPU"] = self.requests_c_p_u
        if self.limits_c_p_u is not None:
            data["limitsCPU"] = self.limits_c_p_u
        if self.requests_memory is not None:
            data["requestsMemory"] = self.requests_memory
        if self.limits_memory is not None:
            data["limitsMemory"] = self.limits_memory
        if self.min_replicas is not None:
            data["minReplicas"] = self.min_replicas
        if self.compute_units is not None:
            data["computeUnits"] = self.compute_units
        if self.server_compute_units is not None:
            data["serverComputeUnits"] = self.server_compute_units
        if self.timeout_seconds is not None:
            data["timeoutSeconds"] = self.timeout_seconds
        if self.worker_type is not None:
            data["workerType"] = self.worker_type
        if self.python_version is not None:
            data["pythonVersion"] = self.python_version
        if self.worker_number is not None:
            data["workerNumber"] = self.worker_number
        if self.base_dockerfile is not None:
            data["baseDockerfile"] = self.base_dockerfile
        if self.queue_messages_per_worker is not None:
            data["queueMessagesPerWorker"] = self.queue_messages_per_worker
        if self.autoscale_min_worker is not None:
            data["autoscaleMinWorker"] = self.autoscale_min_worker
        if self.autoscale_max_worker is not None:
            data["autoscaleMaxWorker"] = self.autoscale_max_worker
        if self.whitelist_ips is not None:
            data["whitelistIps"] = self.whitelist_ips
        if self.executor_pool_size is not None:
            data["executorPoolSize"] = self.executor_pool_size
        if self.min_forms_executors is not None:
            data["minFormsExecutors"] = self.min_forms_executors
        if self.executor_max_executions is not None:
            data["executorMaxExecutions"] = self.executor_max_executions
        if self.executor_warmup_parallelism is not None:
            data["executorWarmupParallelism"] = self.executor_warmup_parallelism
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonDeploymentResourcesProjectDeploymentResources":
        return cls(
            watermark_enabled=None
            if data.get("watermarkEnabled") is None
            else data["watermarkEnabled"],
            selenium_instance_enabled=None
            if data.get("seleniumInstanceEnabled") is None
            else data["seleniumInstanceEnabled"],
            use_cloud_api_player=None
            if data.get("useCloudApiPlayer") is None
            else data["useCloudApiPlayer"],
            notifications_enabled=None
            if data.get("notificationsEnabled") is None
            else data["notificationsEnabled"],
            requests_c_p_u=None
            if data.get("requestsCPU") is None
            else str(data["requestsCPU"]),
            limits_c_p_u=None
            if data.get("limitsCPU") is None
            else str(data["limitsCPU"]),
            requests_memory=None
            if data.get("requestsMemory") is None
            else str(data["requestsMemory"]),
            limits_memory=None
            if data.get("limitsMemory") is None
            else str(data["limitsMemory"]),
            min_replicas=None
            if data.get("minReplicas") is None
            else str(data["minReplicas"]),
            compute_units=None
            if data.get("computeUnits") is None
            else float(data["computeUnits"]),
            server_compute_units=None
            if data.get("serverComputeUnits") is None
            else float(data["serverComputeUnits"]),
            timeout_seconds=None
            if data.get("timeoutSeconds") is None
            else str(data["timeoutSeconds"]),
            worker_type=None
            if data.get("workerType") is None
            else str(data["workerType"]),
            python_version=None
            if data.get("pythonVersion") is None
            else data["pythonVersion"],
            worker_number=None
            if data.get("workerNumber") is None
            else str(data["workerNumber"]),
            base_dockerfile=None
            if data.get("baseDockerfile") is None
            else str(data["baseDockerfile"]),
            queue_messages_per_worker=None
            if data.get("queueMessagesPerWorker") is None
            else str(data["queueMessagesPerWorker"]),
            autoscale_min_worker=None
            if data.get("autoscaleMinWorker") is None
            else str(data["autoscaleMinWorker"]),
            autoscale_max_worker=None
            if data.get("autoscaleMaxWorker") is None
            else str(data["autoscaleMaxWorker"]),
            whitelist_ips=None
            if data.get("whitelistIps") is None
            else [str(item) for item in data["whitelistIps"]],
            executor_pool_size=None
            if data.get("executorPoolSize") is None
            else str(data["executorPoolSize"]),
            min_forms_executors=None
            if data.get("minFormsExecutors") is None
            else str(data["minFormsExecutors"]),
            executor_max_executions=None
            if data.get("executorMaxExecutions") is None
            else str(data["executorMaxExecutions"]),
            executor_warmup_parallelism=None
            if data.get("executorWarmupParallelism") is None
            else str(data["executorWarmupParallelism"]),
        )


CommonFilesItemType = typing.Union[typing.Literal["file"], typing.Literal["directory"]]

CommonFilesItemTypeValues: typing.List[CommonFilesItemType] = ["file", "directory"]

CommonFilesItemPath = str

CommonFilesItemName = str

CommonFilesItemDate = datetime.datetime

CommonFilesItemSizeBytes = int

CommonFilesItemSizeHuman = str

CommonFilesItemItemCount = int


@dataclass
class CommonFilesItem:
    type: CommonFilesItemType
    path: CommonFilesItemPath
    name: CommonFilesItemName
    date: CommonFilesItemDate
    size_bytes: typing.Optional[CommonFilesItemSizeBytes] = field(
        default_factory=lambda: None
    )
    size_human: typing.Optional[CommonFilesItemSizeHuman] = field(
        default_factory=lambda: None
    )
    item_count: typing.Optional[CommonFilesItemItemCount] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["path"] = self.path
        data["name"] = self.name
        data["date"] = self.date.isoformat()
        if self.size_bytes is not None:
            data["sizeBytes"] = self.size_bytes
        if self.size_human is not None:
            data["sizeHuman"] = self.size_human
        if self.item_count is not None:
            data["itemCount"] = self.item_count
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "CommonFilesItem":
        return cls(
            type=data["type"],
            path=str(data["path"]),
            name=str(data["name"]),
            date=datetime.datetime.fromisoformat(data["date"]),
            size_bytes=None
            if data.get("sizeBytes") is None
            else int(data["sizeBytes"]),
            size_human=None
            if data.get("sizeHuman") is None
            else str(data["sizeHuman"]),
            item_count=None
            if data.get("itemCount") is None
            else int(data["itemCount"]),
        )


CommonAiActionsV1StageReplaceCodeAction = typing.Literal["replace-code"]

CommonAiActionsV1StageReplaceCodeActionValues: typing.List[
    CommonAiActionsV1StageReplaceCodeAction
] = ["replace-code"]

CommonAiActionsV1StageReplaceCodeActionLabel = str

CommonAiActionsV1StageReplaceCodeNewCode = str

CommonAiActionsV1StageReplaceCodeType = typing.Literal["replace-code"]

CommonAiActionsV1StageReplaceCodeTypeValues: typing.List[
    CommonAiActionsV1StageReplaceCodeType
] = ["replace-code"]


@dataclass
class CommonAiActionsV1StageReplaceCode:
    action: CommonAiActionsV1StageReplaceCodeAction
    action_label: CommonAiActionsV1StageReplaceCodeActionLabel
    new_code: CommonAiActionsV1StageReplaceCodeNewCode
    type: typing.Optional[CommonAiActionsV1StageReplaceCodeType] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["newCode"] = self.new_code
        if self.type is not None:
            data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1StageReplaceCode":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            new_code=str(data["newCode"]),
            type=None if data.get("type") is None else data["type"],
        )


CommonAiActionsV1StageActionsActionsItem0 = CommonAiActionsV1StageReplaceCode

CommonAiActionsV1StageEditStageNameAction = typing.Literal["edit-stage-name"]

CommonAiActionsV1StageEditStageNameActionValues: typing.List[
    CommonAiActionsV1StageEditStageNameAction
] = ["edit-stage-name"]

CommonAiActionsV1StageEditStageNameActionLabel = str

CommonAiActionsV1StageEditStageNameNewName = str

CommonAiActionsV1StageEditStageNameType = typing.Literal["edit-stage-name"]

CommonAiActionsV1StageEditStageNameTypeValues: typing.List[
    CommonAiActionsV1StageEditStageNameType
] = ["edit-stage-name"]


@dataclass
class CommonAiActionsV1StageEditStageName:
    action: CommonAiActionsV1StageEditStageNameAction
    action_label: CommonAiActionsV1StageEditStageNameActionLabel
    new_name: CommonAiActionsV1StageEditStageNameNewName
    type: typing.Optional[CommonAiActionsV1StageEditStageNameType] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["newName"] = self.new_name
        if self.type is not None:
            data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1StageEditStageName":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            new_name=str(data["newName"]),
            type=None if data.get("type") is None else data["type"],
        )


CommonAiActionsV1StageActionsActionsItem1 = CommonAiActionsV1StageEditStageName

CommonAiActionsV1StageAddNotifiableEmailAction = typing.Literal["add-notifiable-email"]

CommonAiActionsV1StageAddNotifiableEmailActionValues: typing.List[
    CommonAiActionsV1StageAddNotifiableEmailAction
] = ["add-notifiable-email"]

CommonAiActionsV1StageAddNotifiableEmailActionLabel = str

CommonAiActionsV1StageAddNotifiableEmailEmail = str


@dataclass
class CommonAiActionsV1StageAddNotifiableEmail:
    action: CommonAiActionsV1StageAddNotifiableEmailAction
    action_label: CommonAiActionsV1StageAddNotifiableEmailActionLabel
    email: CommonAiActionsV1StageAddNotifiableEmailEmail

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["email"] = self.email
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1StageAddNotifiableEmail":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            email=str(data["email"]),
        )


CommonAiActionsV1StageActionsActionsItem2 = CommonAiActionsV1StageAddNotifiableEmail

CommonAiActionsV1StageEditStageFilenameAction = typing.Literal["edit-stage-filename"]

CommonAiActionsV1StageEditStageFilenameActionValues: typing.List[
    CommonAiActionsV1StageEditStageFilenameAction
] = ["edit-stage-filename"]

CommonAiActionsV1StageEditStageFilenameActionLabel = str

CommonAiActionsV1StageEditStageFilenameNewFilename = str

CommonAiActionsV1StageEditStageFilenameType = typing.Literal["edit-stage-filename"]

CommonAiActionsV1StageEditStageFilenameTypeValues: typing.List[
    CommonAiActionsV1StageEditStageFilenameType
] = ["edit-stage-filename"]


@dataclass
class CommonAiActionsV1StageEditStageFilename:
    action: CommonAiActionsV1StageEditStageFilenameAction
    action_label: CommonAiActionsV1StageEditStageFilenameActionLabel
    new_filename: CommonAiActionsV1StageEditStageFilenameNewFilename
    type: typing.Optional[CommonAiActionsV1StageEditStageFilenameType] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["newFilename"] = self.new_filename
        if self.type is not None:
            data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1StageEditStageFilename":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            new_filename=str(data["newFilename"]),
            type=None if data.get("type") is None else data["type"],
        )


CommonAiActionsV1StageActionsActionsItem3 = CommonAiActionsV1StageEditStageFilename

CommonAiActionsV1StageActionsActionsItem = typing.Union[
    CommonAiActionsV1StageActionsActionsItem0,
    CommonAiActionsV1StageActionsActionsItem1,
    CommonAiActionsV1StageActionsActionsItem2,
    CommonAiActionsV1StageActionsActionsItem3,
]


def common_ai_actions_v1_stage_actions_actions_item_from_dict(
    data: typing.Any,
) -> "CommonAiActionsV1StageActionsActionsItem":
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "replace-code")
        and (data.get("type", None) == "replace-code")
    ):
        return CommonAiActionsV1StageReplaceCode.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "edit-stage-name")
        and (data.get("type", None) == "edit-stage-name")
    ):
        return CommonAiActionsV1StageEditStageName.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "add-notifiable-email"):
        return CommonAiActionsV1StageAddNotifiableEmail.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "edit-stage-filename")
        and (data.get("type", None) == "edit-stage-filename")
    ):
        return CommonAiActionsV1StageEditStageFilename.from_dict(data)
    raise ValueError(
        f"Could not parse CommonAiActionsV1StageActionsActionsItem from dict: {data}"
    )


CommonAiActionsV1StageActionsActions = typing.List[
    CommonAiActionsV1StageActionsActionsItem
]


@dataclass
class CommonAiActionsV1StageActions:
    actions: CommonAiActionsV1StageActionsActions

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["actions"] = [item.to_dict() for item in self.actions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1StageActions":
        return cls(
            actions=[
                (
                    CommonAiActionsV1StageReplaceCode.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "replace-code")
                    and (item.get("type", None) == "replace-code")
                    else CommonAiActionsV1StageEditStageName.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "edit-stage-name")
                    and (item.get("type", None) == "edit-stage-name")
                    else CommonAiActionsV1StageAddNotifiableEmail.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "add-notifiable-email")
                    else CommonAiActionsV1StageEditStageFilename.from_dict(item)
                )
                for item in data["actions"]
            ],
        )


CommonAiActionsV1GeneralCreateTableAction = typing.Literal["create-table"]

CommonAiActionsV1GeneralCreateTableActionValues: typing.List[
    CommonAiActionsV1GeneralCreateTableAction
] = ["create-table"]

CommonAiActionsV1GeneralCreateTableActionLabel = str

CommonAiActionsV1GeneralCreateTableTableId = str

CommonAiActionsV1GeneralCreateTableTableName = str


@dataclass
class CommonAiActionsV1GeneralCreateTable:
    action: CommonAiActionsV1GeneralCreateTableAction
    action_label: CommonAiActionsV1GeneralCreateTableActionLabel
    table_id: CommonAiActionsV1GeneralCreateTableTableId
    table_name: CommonAiActionsV1GeneralCreateTableTableName

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["tableName"] = self.table_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralCreateTable":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            table_name=str(data["tableName"]),
        )


CommonAiActionsV1GeneralActionsActionsItem0 = CommonAiActionsV1GeneralCreateTable

CommonAiActionsV1GeneralCreateColumnAction = typing.Literal["create-column"]

CommonAiActionsV1GeneralCreateColumnActionValues: typing.List[
    CommonAiActionsV1GeneralCreateColumnAction
] = ["create-column"]

CommonAiActionsV1GeneralCreateColumnActionLabel = str

CommonAiActionsV1GeneralCreateColumnTableId = str

CommonAiActionsV1GeneralCreateColumnColumnName = str

CommonAiActionsV1GeneralCreateColumnColumnType = typing.Union[
    typing.Literal["varchar"],
    typing.Literal["int"],
    typing.Literal["boolean"],
    typing.Literal["json"],
    typing.Literal["date"],
    typing.Literal["timestamp"],
    typing.Literal["uuid"],
    typing.Literal["real"],
]

CommonAiActionsV1GeneralCreateColumnColumnTypeValues: typing.List[
    CommonAiActionsV1GeneralCreateColumnColumnType
] = ["varchar", "int", "boolean", "json", "date", "timestamp", "uuid", "real"]

CommonAiActionsV1GeneralCreateColumnNullable = bool

CommonAiActionsV1GeneralCreateColumnDefault = str

CommonAiActionsV1GeneralCreateColumnUnique = bool


@dataclass
class CommonAiActionsV1GeneralCreateColumn:
    action: CommonAiActionsV1GeneralCreateColumnAction
    action_label: CommonAiActionsV1GeneralCreateColumnActionLabel
    table_id: CommonAiActionsV1GeneralCreateColumnTableId
    column_name: CommonAiActionsV1GeneralCreateColumnColumnName
    column_type: CommonAiActionsV1GeneralCreateColumnColumnType
    nullable: CommonAiActionsV1GeneralCreateColumnNullable
    default: CommonAiActionsV1GeneralCreateColumnDefault
    unique: CommonAiActionsV1GeneralCreateColumnUnique

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["columnName"] = self.column_name
        data["columnType"] = self.column_type
        data["nullable"] = self.nullable
        data["default"] = self.default
        data["unique"] = self.unique
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralCreateColumn":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            column_name=str(data["columnName"]),
            column_type=data["columnType"],
            nullable=bool(data["nullable"]),
            default=str(data["default"]),
            unique=bool(data["unique"]),
        )


CommonAiActionsV1GeneralActionsActionsItem1 = CommonAiActionsV1GeneralCreateColumn

CommonAiActionsV1GeneralInsertRowsAction = typing.Literal["insert-rows"]

CommonAiActionsV1GeneralInsertRowsActionValues: typing.List[
    CommonAiActionsV1GeneralInsertRowsAction
] = ["insert-rows"]

CommonAiActionsV1GeneralInsertRowsActionLabel = str

CommonAiActionsV1GeneralInsertRowsTableId = str

CommonAiActionsV1GeneralInsertRowsRowsItem = typing.Dict[str, typing.Any]

CommonAiActionsV1GeneralInsertRowsRows = typing.List[
    CommonAiActionsV1GeneralInsertRowsRowsItem
]


@dataclass
class CommonAiActionsV1GeneralInsertRows:
    action: CommonAiActionsV1GeneralInsertRowsAction
    action_label: CommonAiActionsV1GeneralInsertRowsActionLabel
    table_id: CommonAiActionsV1GeneralInsertRowsTableId
    rows: CommonAiActionsV1GeneralInsertRowsRows

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["rows"] = [item for item in self.rows]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralInsertRows":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            rows=[dict(**item) for item in data["rows"]],
        )


CommonAiActionsV1GeneralActionsActionsItem2 = CommonAiActionsV1GeneralInsertRows

CommonAiActionsV1GeneralEditTableAction = typing.Literal["edit-table"]

CommonAiActionsV1GeneralEditTableActionValues: typing.List[
    CommonAiActionsV1GeneralEditTableAction
] = ["edit-table"]

CommonAiActionsV1GeneralEditTableActionLabel = str

CommonAiActionsV1GeneralEditTableTableId = str

CommonAiActionsV1GeneralEditTableNewTableName = str


@dataclass
class CommonAiActionsV1GeneralEditTable:
    action: CommonAiActionsV1GeneralEditTableAction
    action_label: CommonAiActionsV1GeneralEditTableActionLabel
    table_id: CommonAiActionsV1GeneralEditTableTableId
    new_table_name: CommonAiActionsV1GeneralEditTableNewTableName

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["newTableName"] = self.new_table_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditTable":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            new_table_name=str(data["newTableName"]),
        )


CommonAiActionsV1GeneralActionsActionsItem3 = CommonAiActionsV1GeneralEditTable

CommonAiActionsV1GeneralEditColumnAction = typing.Literal["edit-column"]

CommonAiActionsV1GeneralEditColumnActionValues: typing.List[
    CommonAiActionsV1GeneralEditColumnAction
] = ["edit-column"]

CommonAiActionsV1GeneralEditColumnActionLabel = str

CommonAiActionsV1GeneralEditColumnColumnId = str

CommonAiActionsV1GeneralEditColumnTableId = str

CommonAiActionsV1GeneralEditColumnChangesColumnName = str

CommonAiActionsV1GeneralEditColumnChangesColumnType = typing.Union[
    typing.Literal["varchar"],
    typing.Literal["int"],
    typing.Literal["boolean"],
    typing.Literal["json"],
    typing.Literal["date"],
    typing.Literal["timestamp"],
    typing.Literal["uuid"],
    typing.Literal["real"],
]

CommonAiActionsV1GeneralEditColumnChangesColumnTypeValues: typing.List[
    CommonAiActionsV1GeneralEditColumnChangesColumnType
] = ["varchar", "int", "boolean", "json", "date", "timestamp", "uuid", "real"]

CommonAiActionsV1GeneralEditColumnChangesNullable = bool

CommonAiActionsV1GeneralEditColumnChangesDefault = str

CommonAiActionsV1GeneralEditColumnChangesUnique = bool

CommonAiActionsV1GeneralEditColumnChangesForeignKeyColumnId = str


@dataclass
class CommonAiActionsV1GeneralEditColumnChangesForeignKey:
    column_id: CommonAiActionsV1GeneralEditColumnChangesForeignKeyColumnId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["columnId"] = self.column_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditColumnChangesForeignKey":
        return cls(
            column_id=str(data["columnId"]),
        )


@dataclass
class CommonAiActionsV1GeneralEditColumnChanges:
    column_name: typing.Optional[
        CommonAiActionsV1GeneralEditColumnChangesColumnName
    ] = field(default_factory=lambda: None)
    column_type: typing.Optional[
        CommonAiActionsV1GeneralEditColumnChangesColumnType
    ] = field(default_factory=lambda: None)
    nullable: typing.Optional[CommonAiActionsV1GeneralEditColumnChangesNullable] = (
        field(default_factory=lambda: None)
    )
    default: typing.Optional[CommonAiActionsV1GeneralEditColumnChangesDefault] = field(
        default_factory=lambda: None
    )
    unique: typing.Optional[CommonAiActionsV1GeneralEditColumnChangesUnique] = field(
        default_factory=lambda: None
    )
    foreign_key: typing.Optional[
        CommonAiActionsV1GeneralEditColumnChangesForeignKey
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.column_name is not None:
            data["columnName"] = self.column_name
        if self.column_type is not None:
            data["columnType"] = self.column_type
        if self.nullable is not None:
            data["nullable"] = self.nullable
        if self.default is not None:
            data["default"] = self.default
        if self.unique is not None:
            data["unique"] = self.unique
        if self.foreign_key is not None:
            data["foreignKey"] = self.foreign_key.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditColumnChanges":
        return cls(
            column_name=None
            if data.get("columnName") is None
            else str(data["columnName"]),
            column_type=None if data.get("columnType") is None else data["columnType"],
            nullable=None if data.get("nullable") is None else bool(data["nullable"]),
            default=None if data.get("default") is None else str(data["default"]),
            unique=None if data.get("unique") is None else bool(data["unique"]),
            foreign_key=None
            if data.get("foreignKey") is None
            else CommonAiActionsV1GeneralEditColumnChangesForeignKey.from_dict(
                data["foreignKey"]
            ),
        )


@dataclass
class CommonAiActionsV1GeneralEditColumn:
    action: CommonAiActionsV1GeneralEditColumnAction
    action_label: CommonAiActionsV1GeneralEditColumnActionLabel
    column_id: CommonAiActionsV1GeneralEditColumnColumnId
    table_id: CommonAiActionsV1GeneralEditColumnTableId
    changes: CommonAiActionsV1GeneralEditColumnChanges

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["columnId"] = self.column_id
        data["tableId"] = self.table_id
        data["changes"] = self.changes.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditColumn":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            column_id=str(data["columnId"]),
            table_id=str(data["tableId"]),
            changes=CommonAiActionsV1GeneralEditColumnChanges.from_dict(
                data["changes"]
            ),
        )


CommonAiActionsV1GeneralActionsActionsItem4 = CommonAiActionsV1GeneralEditColumn

CommonAiActionsV1GeneralEditEnvVarAction = typing.Literal["edit-env-var"]

CommonAiActionsV1GeneralEditEnvVarActionValues: typing.List[
    CommonAiActionsV1GeneralEditEnvVarAction
] = ["edit-env-var"]

CommonAiActionsV1GeneralEditEnvVarActionLabel = str

CommonAiActionsV1GeneralEditEnvVarKey = str

CommonAiActionsV1GeneralEditEnvVarNewValue = str


@dataclass
class CommonAiActionsV1GeneralEditEnvVar:
    action: CommonAiActionsV1GeneralEditEnvVarAction
    action_label: CommonAiActionsV1GeneralEditEnvVarActionLabel
    key: CommonAiActionsV1GeneralEditEnvVarKey
    new_value: CommonAiActionsV1GeneralEditEnvVarNewValue

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["key"] = self.key
        data["newValue"] = self.new_value
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditEnvVar":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            key=str(data["key"]),
            new_value=str(data["newValue"]),
        )


CommonAiActionsV1GeneralActionsActionsItem5 = CommonAiActionsV1GeneralEditEnvVar

CommonAiActionsV1GeneralSetEnvVarAction = typing.Literal["set-env-var"]

CommonAiActionsV1GeneralSetEnvVarActionValues: typing.List[
    CommonAiActionsV1GeneralSetEnvVarAction
] = ["set-env-var"]

CommonAiActionsV1GeneralSetEnvVarActionLabel = str

CommonAiActionsV1GeneralSetEnvVarKey = str

CommonAiActionsV1GeneralSetEnvVarValue = str


@dataclass
class CommonAiActionsV1GeneralSetEnvVar:
    action: CommonAiActionsV1GeneralSetEnvVarAction
    action_label: CommonAiActionsV1GeneralSetEnvVarActionLabel
    key: CommonAiActionsV1GeneralSetEnvVarKey
    value: CommonAiActionsV1GeneralSetEnvVarValue

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["key"] = self.key
        data["value"] = self.value
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralSetEnvVar":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            key=str(data["key"]),
            value=str(data["value"]),
        )


CommonAiActionsV1GeneralActionsActionsItem6 = CommonAiActionsV1GeneralSetEnvVar

CommonAiActionsV1GeneralInstallPackageAction = typing.Literal["install-package"]

CommonAiActionsV1GeneralInstallPackageActionValues: typing.List[
    CommonAiActionsV1GeneralInstallPackageAction
] = ["install-package"]

CommonAiActionsV1GeneralInstallPackageActionLabel = str

CommonAiActionsV1GeneralInstallPackagePackageName = str


@dataclass
class CommonAiActionsV1GeneralInstallPackage:
    action: CommonAiActionsV1GeneralInstallPackageAction
    action_label: CommonAiActionsV1GeneralInstallPackageActionLabel
    package_name: CommonAiActionsV1GeneralInstallPackagePackageName

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["packageName"] = self.package_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralInstallPackage":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            package_name=str(data["packageName"]),
        )


CommonAiActionsV1GeneralActionsActionsItem7 = CommonAiActionsV1GeneralInstallPackage

CommonAiActionsV1GeneralCreateStageAction = typing.Literal["create-stage"]

CommonAiActionsV1GeneralCreateStageActionValues: typing.List[
    CommonAiActionsV1GeneralCreateStageAction
] = ["create-stage"]

CommonAiActionsV1GeneralCreateStageActionLabel = str

CommonAiActionsV1GeneralCreateStageId = str

CommonAiActionsV1GeneralCreateStageStageType = typing.Union[
    typing.Literal["form"],
    typing.Literal["job"],
    typing.Literal["hook"],
    typing.Literal["tasklet"],
]

CommonAiActionsV1GeneralCreateStageStageTypeValues: typing.List[
    CommonAiActionsV1GeneralCreateStageStageType
] = ["form", "job", "hook", "tasklet"]

CommonAiActionsV1GeneralCreateStageStageName = str

CommonAiActionsV1GeneralCreateStageCode = str

CommonAiActionsV1GeneralCreateStageFilename = str

CommonAiActionsV1GeneralCreateStagePositionX = float

CommonAiActionsV1GeneralCreateStagePositionY = float


@dataclass
class CommonAiActionsV1GeneralCreateStagePosition:
    x: CommonAiActionsV1GeneralCreateStagePositionX
    y: CommonAiActionsV1GeneralCreateStagePositionY

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["x"] = self.x
        data["y"] = self.y
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralCreateStagePosition":
        return cls(
            x=float(data["x"]),
            y=float(data["y"]),
        )


CommonAiActionsV1GeneralCreateStageType = typing.Literal["create-stage"]

CommonAiActionsV1GeneralCreateStageTypeValues: typing.List[
    CommonAiActionsV1GeneralCreateStageType
] = ["create-stage"]


@dataclass
class CommonAiActionsV1GeneralCreateStage:
    action: CommonAiActionsV1GeneralCreateStageAction
    action_label: CommonAiActionsV1GeneralCreateStageActionLabel
    id: CommonAiActionsV1GeneralCreateStageId
    stage_type: CommonAiActionsV1GeneralCreateStageStageType
    stage_name: CommonAiActionsV1GeneralCreateStageStageName
    code: CommonAiActionsV1GeneralCreateStageCode
    filename: CommonAiActionsV1GeneralCreateStageFilename
    position: CommonAiActionsV1GeneralCreateStagePosition
    type: typing.Optional[CommonAiActionsV1GeneralCreateStageType] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["id"] = self.id
        data["stageType"] = self.stage_type
        data["stageName"] = self.stage_name
        data["code"] = self.code
        data["filename"] = self.filename
        data["position"] = self.position.to_dict()
        if self.type is not None:
            data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralCreateStage":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            id=str(data["id"]),
            stage_type=data["stageType"],
            stage_name=str(data["stageName"]),
            code=str(data["code"]),
            filename=str(data["filename"]),
            position=CommonAiActionsV1GeneralCreateStagePosition.from_dict(
                data["position"]
            ),
            type=None if data.get("type") is None else data["type"],
        )


CommonAiActionsV1GeneralActionsActionsItem8 = CommonAiActionsV1GeneralCreateStage

CommonAiActionsV1GeneralCreateTransitionAction = typing.Literal["add-transition"]

CommonAiActionsV1GeneralCreateTransitionActionValues: typing.List[
    CommonAiActionsV1GeneralCreateTransitionAction
] = ["add-transition"]

CommonAiActionsV1GeneralCreateTransitionActionLabel = str

CommonAiActionsV1GeneralCreateTransitionSourceStageId = str

CommonAiActionsV1GeneralCreateTransitionTargetStageId = str


@dataclass
class CommonAiActionsV1GeneralCreateTransition:
    action: CommonAiActionsV1GeneralCreateTransitionAction
    action_label: CommonAiActionsV1GeneralCreateTransitionActionLabel
    source_stage_id: CommonAiActionsV1GeneralCreateTransitionSourceStageId
    target_stage_id: CommonAiActionsV1GeneralCreateTransitionTargetStageId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["sourceStageId"] = self.source_stage_id
        data["targetStageId"] = self.target_stage_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralCreateTransition":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            source_stage_id=str(data["sourceStageId"]),
            target_stage_id=str(data["targetStageId"]),
        )


CommonAiActionsV1GeneralActionsActionsItem9 = CommonAiActionsV1GeneralCreateTransition

CommonAiActionsV1GeneralEditStageAction = typing.Literal["edit-stage"]

CommonAiActionsV1GeneralEditStageActionValues: typing.List[
    CommonAiActionsV1GeneralEditStageAction
] = ["edit-stage"]

CommonAiActionsV1GeneralEditStageActionLabel = str

CommonAiActionsV1GeneralEditStageStageId = str

CommonAiActionsV1GeneralEditStageStageType = typing.Union[
    typing.Literal["form"],
    typing.Literal["job"],
    typing.Literal["hook"],
    typing.Literal["tasklet"],
]

CommonAiActionsV1GeneralEditStageStageTypeValues: typing.List[
    CommonAiActionsV1GeneralEditStageStageType
] = ["form", "job", "hook", "tasklet"]

CommonAiActionsV1GeneralEditStageStageNewTitle = str


@dataclass
class CommonAiActionsV1GeneralEditStage:
    action: CommonAiActionsV1GeneralEditStageAction
    action_label: CommonAiActionsV1GeneralEditStageActionLabel
    stage_id: CommonAiActionsV1GeneralEditStageStageId
    stage_type: CommonAiActionsV1GeneralEditStageStageType
    stage_new_title: CommonAiActionsV1GeneralEditStageStageNewTitle

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["stageId"] = self.stage_id
        data["stageType"] = self.stage_type
        data["stageNewTitle"] = self.stage_new_title
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralEditStage":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            stage_id=str(data["stageId"]),
            stage_type=data["stageType"],
            stage_new_title=str(data["stageNewTitle"]),
        )


CommonAiActionsV1GeneralActionsActionsItem10 = CommonAiActionsV1GeneralEditStage

CommonAiActionsV1GeneralActionsActionsItem = typing.Union[
    CommonAiActionsV1GeneralActionsActionsItem0,
    CommonAiActionsV1GeneralActionsActionsItem1,
    CommonAiActionsV1GeneralActionsActionsItem2,
    CommonAiActionsV1GeneralActionsActionsItem3,
    CommonAiActionsV1GeneralActionsActionsItem4,
    CommonAiActionsV1GeneralActionsActionsItem5,
    CommonAiActionsV1GeneralActionsActionsItem6,
    CommonAiActionsV1GeneralActionsActionsItem7,
    CommonAiActionsV1GeneralActionsActionsItem8,
    CommonAiActionsV1GeneralActionsActionsItem9,
    CommonAiActionsV1GeneralActionsActionsItem10,
]


def common_ai_actions_v1_general_actions_actions_item_from_dict(
    data: typing.Any,
) -> "CommonAiActionsV1GeneralActionsActionsItem":
    if isinstance(data, dict) and (data.get("action", None) == "create-table"):
        return CommonAiActionsV1GeneralCreateTable.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "create-column")
        and (
            data.get("columnType", None) == "varchar"
            or data.get("columnType", None) == "int"
            or data.get("columnType", None) == "boolean"
            or data.get("columnType", None) == "json"
            or data.get("columnType", None) == "date"
            or data.get("columnType", None) == "timestamp"
            or data.get("columnType", None) == "uuid"
            or data.get("columnType", None) == "real"
        )
    ):
        return CommonAiActionsV1GeneralCreateColumn.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "insert-rows"):
        return CommonAiActionsV1GeneralInsertRows.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "edit-table"):
        return CommonAiActionsV1GeneralEditTable.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "edit-column"):
        return CommonAiActionsV1GeneralEditColumn.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "edit-env-var"):
        return CommonAiActionsV1GeneralEditEnvVar.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "set-env-var"):
        return CommonAiActionsV1GeneralSetEnvVar.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "install-package"):
        return CommonAiActionsV1GeneralInstallPackage.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "create-stage")
        and (
            data.get("stageType", None) == "form"
            or data.get("stageType", None) == "job"
            or data.get("stageType", None) == "hook"
            or data.get("stageType", None) == "tasklet"
        )
        and (data.get("type", None) == "create-stage")
    ):
        return CommonAiActionsV1GeneralCreateStage.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "add-transition"):
        return CommonAiActionsV1GeneralCreateTransition.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "edit-stage")
        and (
            data.get("stageType", None) == "form"
            or data.get("stageType", None) == "job"
            or data.get("stageType", None) == "hook"
            or data.get("stageType", None) == "tasklet"
        )
    ):
        return CommonAiActionsV1GeneralEditStage.from_dict(data)
    raise ValueError(
        f"Could not parse CommonAiActionsV1GeneralActionsActionsItem from dict: {data}"
    )


CommonAiActionsV1GeneralActionsActions = typing.List[
    CommonAiActionsV1GeneralActionsActionsItem
]


@dataclass
class CommonAiActionsV1GeneralActions:
    actions: CommonAiActionsV1GeneralActionsActions

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["actions"] = [item.to_dict() for item in self.actions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV1GeneralActions":
        return cls(
            actions=[
                (
                    CommonAiActionsV1GeneralCreateTable.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-table")
                    else CommonAiActionsV1GeneralCreateColumn.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-column")
                    and (
                        item.get("columnType", None) == "varchar"
                        or item.get("columnType", None) == "int"
                        or item.get("columnType", None) == "boolean"
                        or item.get("columnType", None) == "json"
                        or item.get("columnType", None) == "date"
                        or item.get("columnType", None) == "timestamp"
                        or item.get("columnType", None) == "uuid"
                        or item.get("columnType", None) == "real"
                    )
                    else CommonAiActionsV1GeneralInsertRows.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "insert-rows")
                    else CommonAiActionsV1GeneralEditTable.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "edit-table")
                    else CommonAiActionsV1GeneralEditColumn.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "edit-column")
                    else CommonAiActionsV1GeneralEditEnvVar.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "edit-env-var")
                    else CommonAiActionsV1GeneralSetEnvVar.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "set-env-var")
                    else CommonAiActionsV1GeneralInstallPackage.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "install-package")
                    else CommonAiActionsV1GeneralCreateStage.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-stage")
                    and (
                        item.get("stageType", None) == "form"
                        or item.get("stageType", None) == "job"
                        or item.get("stageType", None) == "hook"
                        or item.get("stageType", None) == "tasklet"
                    )
                    and (item.get("type", None) == "create-stage")
                    else CommonAiActionsV1GeneralCreateTransition.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "add-transition")
                    else CommonAiActionsV1GeneralEditStage.from_dict(item)
                )
                for item in data["actions"]
            ],
        )


CommonAiActionsV0StageReplaceCodeAction = typing.Literal["replace-code"]

CommonAiActionsV0StageReplaceCodeActionValues: typing.List[
    CommonAiActionsV0StageReplaceCodeAction
] = ["replace-code"]

CommonAiActionsV0StageReplaceCodeActionLabel = str

CommonAiActionsV0StageReplaceCodeLinesStart = float

CommonAiActionsV0StageReplaceCodeLinesEnd = float


@dataclass
class CommonAiActionsV0StageReplaceCodeLines:
    start: CommonAiActionsV0StageReplaceCodeLinesStart
    end: CommonAiActionsV0StageReplaceCodeLinesEnd

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["start"] = self.start
        data["end"] = self.end
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0StageReplaceCodeLines":
        return cls(
            start=float(data["start"]),
            end=float(data["end"]),
        )


CommonAiActionsV0StageReplaceCodeNewCode = str


@dataclass
class CommonAiActionsV0StageReplaceCode:
    action: CommonAiActionsV0StageReplaceCodeAction
    action_label: CommonAiActionsV0StageReplaceCodeActionLabel
    lines: CommonAiActionsV0StageReplaceCodeLines
    new_code: CommonAiActionsV0StageReplaceCodeNewCode

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["lines"] = self.lines.to_dict()
        data["newCode"] = self.new_code
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0StageReplaceCode":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            lines=CommonAiActionsV0StageReplaceCodeLines.from_dict(data["lines"]),
            new_code=str(data["newCode"]),
        )


CommonAiActionsV0StageActionsActionsItem0 = CommonAiActionsV0StageReplaceCode

CommonAiActionsV0StageEditStageNameAction = typing.Literal["edit-stage-name"]

CommonAiActionsV0StageEditStageNameActionValues: typing.List[
    CommonAiActionsV0StageEditStageNameAction
] = ["edit-stage-name"]

CommonAiActionsV0StageEditStageNameActionLabel = str

CommonAiActionsV0StageEditStageNameNewName = str


@dataclass
class CommonAiActionsV0StageEditStageName:
    action: CommonAiActionsV0StageEditStageNameAction
    action_label: CommonAiActionsV0StageEditStageNameActionLabel
    new_name: CommonAiActionsV0StageEditStageNameNewName

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["newName"] = self.new_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0StageEditStageName":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            new_name=str(data["newName"]),
        )


CommonAiActionsV0StageActionsActionsItem1 = CommonAiActionsV0StageEditStageName

CommonAiActionsV0StageAddNotifiableEmailAction = typing.Literal["add-notifiable-email"]

CommonAiActionsV0StageAddNotifiableEmailActionValues: typing.List[
    CommonAiActionsV0StageAddNotifiableEmailAction
] = ["add-notifiable-email"]

CommonAiActionsV0StageAddNotifiableEmailActionLabel = str

CommonAiActionsV0StageAddNotifiableEmailEmail = str


@dataclass
class CommonAiActionsV0StageAddNotifiableEmail:
    action: CommonAiActionsV0StageAddNotifiableEmailAction
    action_label: CommonAiActionsV0StageAddNotifiableEmailActionLabel
    email: CommonAiActionsV0StageAddNotifiableEmailEmail

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["email"] = self.email
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0StageAddNotifiableEmail":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            email=str(data["email"]),
        )


CommonAiActionsV0StageActionsActionsItem2 = CommonAiActionsV0StageAddNotifiableEmail

CommonAiActionsV0StageActionsActionsItem = typing.Union[
    CommonAiActionsV0StageActionsActionsItem0,
    CommonAiActionsV0StageActionsActionsItem1,
    CommonAiActionsV0StageActionsActionsItem2,
]


def common_ai_actions_v0_stage_actions_actions_item_from_dict(
    data: typing.Any,
) -> "CommonAiActionsV0StageActionsActionsItem":
    if isinstance(data, dict) and (data.get("action", None) == "replace-code"):
        return CommonAiActionsV0StageReplaceCode.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "edit-stage-name"):
        return CommonAiActionsV0StageEditStageName.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "add-notifiable-email"):
        return CommonAiActionsV0StageAddNotifiableEmail.from_dict(data)
    raise ValueError(
        f"Could not parse CommonAiActionsV0StageActionsActionsItem from dict: {data}"
    )


CommonAiActionsV0StageActionsActions = typing.List[
    CommonAiActionsV0StageActionsActionsItem
]


@dataclass
class CommonAiActionsV0StageActions:
    actions: CommonAiActionsV0StageActionsActions

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["actions"] = [item.to_dict() for item in self.actions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0StageActions":
        return cls(
            actions=[
                (
                    CommonAiActionsV0StageReplaceCode.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "replace-code")
                    else CommonAiActionsV0StageEditStageName.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "edit-stage-name")
                    else CommonAiActionsV0StageAddNotifiableEmail.from_dict(item)
                )
                for item in data["actions"]
            ],
        )


CommonAiActionsV0GeneralCreateTableAction = typing.Literal["create-table"]

CommonAiActionsV0GeneralCreateTableActionValues: typing.List[
    CommonAiActionsV0GeneralCreateTableAction
] = ["create-table"]

CommonAiActionsV0GeneralCreateTableActionLabel = str

CommonAiActionsV0GeneralCreateTableTableId = str

CommonAiActionsV0GeneralCreateTableTableName = str


@dataclass
class CommonAiActionsV0GeneralCreateTable:
    action: CommonAiActionsV0GeneralCreateTableAction
    action_label: CommonAiActionsV0GeneralCreateTableActionLabel
    table_id: CommonAiActionsV0GeneralCreateTableTableId
    table_name: CommonAiActionsV0GeneralCreateTableTableName

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["tableName"] = self.table_name
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralCreateTable":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            table_name=str(data["tableName"]),
        )


CommonAiActionsV0GeneralActionsActionsItem0 = CommonAiActionsV0GeneralCreateTable

CommonAiActionsV0GeneralCreateColumnAction = typing.Literal["create-column"]

CommonAiActionsV0GeneralCreateColumnActionValues: typing.List[
    CommonAiActionsV0GeneralCreateColumnAction
] = ["create-column"]

CommonAiActionsV0GeneralCreateColumnActionLabel = str

CommonAiActionsV0GeneralCreateColumnTableId = str

CommonAiActionsV0GeneralCreateColumnColumnName = str

CommonAiActionsV0GeneralCreateColumnColumnType = typing.Union[
    typing.Literal["varchar"],
    typing.Literal["int"],
    typing.Literal["boolean"],
    typing.Literal["json"],
    typing.Literal["date"],
    typing.Literal["timestamp"],
    typing.Literal["uuid"],
    typing.Literal["real"],
]

CommonAiActionsV0GeneralCreateColumnColumnTypeValues: typing.List[
    CommonAiActionsV0GeneralCreateColumnColumnType
] = ["varchar", "int", "boolean", "json", "date", "timestamp", "uuid", "real"]


@dataclass
class CommonAiActionsV0GeneralCreateColumn:
    action: CommonAiActionsV0GeneralCreateColumnAction
    action_label: CommonAiActionsV0GeneralCreateColumnActionLabel
    table_id: CommonAiActionsV0GeneralCreateColumnTableId
    column_name: CommonAiActionsV0GeneralCreateColumnColumnName
    column_type: CommonAiActionsV0GeneralCreateColumnColumnType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["tableId"] = self.table_id
        data["columnName"] = self.column_name
        data["columnType"] = self.column_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralCreateColumn":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            table_id=str(data["tableId"]),
            column_name=str(data["columnName"]),
            column_type=data["columnType"],
        )


CommonAiActionsV0GeneralActionsActionsItem1 = CommonAiActionsV0GeneralCreateColumn

CommonAiActionsV0GeneralSetEnvVarAction = typing.Literal["set-env-var"]

CommonAiActionsV0GeneralSetEnvVarActionValues: typing.List[
    CommonAiActionsV0GeneralSetEnvVarAction
] = ["set-env-var"]

CommonAiActionsV0GeneralSetEnvVarActionLabel = str

CommonAiActionsV0GeneralSetEnvVarKey = str

CommonAiActionsV0GeneralSetEnvVarValue = str


@dataclass
class CommonAiActionsV0GeneralSetEnvVar:
    action: CommonAiActionsV0GeneralSetEnvVarAction
    action_label: CommonAiActionsV0GeneralSetEnvVarActionLabel
    key: CommonAiActionsV0GeneralSetEnvVarKey
    value: CommonAiActionsV0GeneralSetEnvVarValue

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["key"] = self.key
        data["value"] = self.value
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralSetEnvVar":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            key=str(data["key"]),
            value=str(data["value"]),
        )


CommonAiActionsV0GeneralActionsActionsItem2 = CommonAiActionsV0GeneralSetEnvVar

CommonAiActionsV0GeneralCreateStageAction = typing.Literal["create-stage"]

CommonAiActionsV0GeneralCreateStageActionValues: typing.List[
    CommonAiActionsV0GeneralCreateStageAction
] = ["create-stage"]

CommonAiActionsV0GeneralCreateStageActionLabel = str

CommonAiActionsV0GeneralCreateStageId = str

CommonAiActionsV0GeneralCreateStageStageType = typing.Union[
    typing.Literal["form"],
    typing.Literal["job"],
    typing.Literal["hook"],
    typing.Literal["tasklet"],
]

CommonAiActionsV0GeneralCreateStageStageTypeValues: typing.List[
    CommonAiActionsV0GeneralCreateStageStageType
] = ["form", "job", "hook", "tasklet"]

CommonAiActionsV0GeneralCreateStageStageName = str

CommonAiActionsV0GeneralCreateStageCode = str

CommonAiActionsV0GeneralCreateStageFilename = str

CommonAiActionsV0GeneralCreateStagePositionX = float

CommonAiActionsV0GeneralCreateStagePositionY = float


@dataclass
class CommonAiActionsV0GeneralCreateStagePosition:
    x: CommonAiActionsV0GeneralCreateStagePositionX
    y: CommonAiActionsV0GeneralCreateStagePositionY

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["x"] = self.x
        data["y"] = self.y
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralCreateStagePosition":
        return cls(
            x=float(data["x"]),
            y=float(data["y"]),
        )


@dataclass
class CommonAiActionsV0GeneralCreateStage:
    action: CommonAiActionsV0GeneralCreateStageAction
    action_label: CommonAiActionsV0GeneralCreateStageActionLabel
    id: CommonAiActionsV0GeneralCreateStageId
    stage_type: CommonAiActionsV0GeneralCreateStageStageType
    stage_name: CommonAiActionsV0GeneralCreateStageStageName
    code: CommonAiActionsV0GeneralCreateStageCode
    filename: CommonAiActionsV0GeneralCreateStageFilename
    position: CommonAiActionsV0GeneralCreateStagePosition

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["id"] = self.id
        data["stageType"] = self.stage_type
        data["stageName"] = self.stage_name
        data["code"] = self.code
        data["filename"] = self.filename
        data["position"] = self.position.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralCreateStage":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            id=str(data["id"]),
            stage_type=data["stageType"],
            stage_name=str(data["stageName"]),
            code=str(data["code"]),
            filename=str(data["filename"]),
            position=CommonAiActionsV0GeneralCreateStagePosition.from_dict(
                data["position"]
            ),
        )


CommonAiActionsV0GeneralActionsActionsItem3 = CommonAiActionsV0GeneralCreateStage

CommonAiActionsV0GeneralCreateTransitionAction = typing.Literal["add-transition"]

CommonAiActionsV0GeneralCreateTransitionActionValues: typing.List[
    CommonAiActionsV0GeneralCreateTransitionAction
] = ["add-transition"]

CommonAiActionsV0GeneralCreateTransitionActionLabel = str

CommonAiActionsV0GeneralCreateTransitionSourceStageId = str

CommonAiActionsV0GeneralCreateTransitionTargetStageId = str


@dataclass
class CommonAiActionsV0GeneralCreateTransition:
    action: CommonAiActionsV0GeneralCreateTransitionAction
    action_label: CommonAiActionsV0GeneralCreateTransitionActionLabel
    source_stage_id: CommonAiActionsV0GeneralCreateTransitionSourceStageId
    target_stage_id: CommonAiActionsV0GeneralCreateTransitionTargetStageId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["action"] = self.action
        data["actionLabel"] = self.action_label
        data["sourceStageId"] = self.source_stage_id
        data["targetStageId"] = self.target_stage_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralCreateTransition":
        return cls(
            action=data["action"],
            action_label=str(data["actionLabel"]),
            source_stage_id=str(data["sourceStageId"]),
            target_stage_id=str(data["targetStageId"]),
        )


CommonAiActionsV0GeneralActionsActionsItem4 = CommonAiActionsV0GeneralCreateTransition

CommonAiActionsV0GeneralActionsActionsItem = typing.Union[
    CommonAiActionsV0GeneralActionsActionsItem0,
    CommonAiActionsV0GeneralActionsActionsItem1,
    CommonAiActionsV0GeneralActionsActionsItem2,
    CommonAiActionsV0GeneralActionsActionsItem3,
    CommonAiActionsV0GeneralActionsActionsItem4,
]


def common_ai_actions_v0_general_actions_actions_item_from_dict(
    data: typing.Any,
) -> "CommonAiActionsV0GeneralActionsActionsItem":
    if isinstance(data, dict) and (data.get("action", None) == "create-table"):
        return CommonAiActionsV0GeneralCreateTable.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "create-column")
        and (
            data.get("columnType", None) == "varchar"
            or data.get("columnType", None) == "int"
            or data.get("columnType", None) == "boolean"
            or data.get("columnType", None) == "json"
            or data.get("columnType", None) == "date"
            or data.get("columnType", None) == "timestamp"
            or data.get("columnType", None) == "uuid"
            or data.get("columnType", None) == "real"
        )
    ):
        return CommonAiActionsV0GeneralCreateColumn.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "set-env-var"):
        return CommonAiActionsV0GeneralSetEnvVar.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("action", None) == "create-stage")
        and (
            data.get("stageType", None) == "form"
            or data.get("stageType", None) == "job"
            or data.get("stageType", None) == "hook"
            or data.get("stageType", None) == "tasklet"
        )
    ):
        return CommonAiActionsV0GeneralCreateStage.from_dict(data)
    if isinstance(data, dict) and (data.get("action", None) == "add-transition"):
        return CommonAiActionsV0GeneralCreateTransition.from_dict(data)
    raise ValueError(
        f"Could not parse CommonAiActionsV0GeneralActionsActionsItem from dict: {data}"
    )


CommonAiActionsV0GeneralActionsActions = typing.List[
    CommonAiActionsV0GeneralActionsActionsItem
]


@dataclass
class CommonAiActionsV0GeneralActions:
    actions: CommonAiActionsV0GeneralActionsActions

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["actions"] = [item.to_dict() for item in self.actions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CommonAiActionsV0GeneralActions":
        return cls(
            actions=[
                (
                    CommonAiActionsV0GeneralCreateTable.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-table")
                    else CommonAiActionsV0GeneralCreateColumn.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-column")
                    and (
                        item.get("columnType", None) == "varchar"
                        or item.get("columnType", None) == "int"
                        or item.get("columnType", None) == "boolean"
                        or item.get("columnType", None) == "json"
                        or item.get("columnType", None) == "date"
                        or item.get("columnType", None) == "timestamp"
                        or item.get("columnType", None) == "uuid"
                        or item.get("columnType", None) == "real"
                    )
                    else CommonAiActionsV0GeneralSetEnvVar.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "set-env-var")
                    else CommonAiActionsV0GeneralCreateStage.from_dict(item)
                    if isinstance(item, dict)
                    and (item.get("action", None) == "create-stage")
                    and (
                        item.get("stageType", None) == "form"
                        or item.get("stageType", None) == "job"
                        or item.get("stageType", None) == "hook"
                        or item.get("stageType", None) == "tasklet"
                    )
                    else CommonAiActionsV0GeneralCreateTransition.from_dict(item)
                )
                for item in data["actions"]
            ],
        )


CloudApiCliApiKeyInfoResponseAuthorId = str

CloudApiCliApiKeyInfoResponseProjectId = str

CloudApiCliApiKeyInfoResponseEmail = str

CloudApiCliApiKeyInfoResponseIntercomHash = str


@dataclass
class CloudApiCliApiKeyInfoResponse:
    author_id: CloudApiCliApiKeyInfoResponseAuthorId
    project_id: CloudApiCliApiKeyInfoResponseProjectId
    email: CloudApiCliApiKeyInfoResponseEmail
    intercom_hash: CloudApiCliApiKeyInfoResponseIntercomHash

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["authorId"] = self.author_id
        data["projectId"] = self.project_id
        data["email"] = self.email
        data["intercomHash"] = self.intercom_hash
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliApiKeyInfoResponse":
        return cls(
            author_id=str(data["authorId"]),
            project_id=str(data["projectId"]),
            email=str(data["email"]),
            intercom_hash=str(data["intercomHash"]),
        )


CloudApiCliBuildCreateResponseUrl = str

CloudApiCliBuildCreateResponseBuildId = str


@dataclass
class CloudApiCliBuildCreateResponse:
    url: CloudApiCliBuildCreateResponseUrl
    build_id: CloudApiCliBuildCreateResponseBuildId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["url"] = self.url
        data["buildId"] = self.build_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliBuildCreateResponse":
        return cls(
            url=str(data["url"]),
            build_id=str(data["buildId"]),
        )


CloudApiCliModelsNfseResponseBairroPrestador = str

CloudApiCliModelsNfseResponseBairroTomador = str

CloudApiCliModelsNfseResponseCepPrestador = str

CloudApiCliModelsNfseResponseCepTomador = str

CloudApiCliModelsNfseResponseCnpjPrestador = str

CloudApiCliModelsNfseResponseCnpjTomador = str

CloudApiCliModelsNfseResponseCodigoServico = str

CloudApiCliModelsNfseResponseDataEmissao = datetime.date

CloudApiCliModelsNfseResponseDescricao = str

CloudApiCliModelsNfseResponseEmailPrestador = str

CloudApiCliModelsNfseResponseEmailTomador = str

CloudApiCliModelsNfseResponseEnderecoPrestador = str

CloudApiCliModelsNfseResponseEnderecoTomador = str

CloudApiCliModelsNfseResponseInscricaoMunicipalPrestador = str

CloudApiCliModelsNfseResponseMunicipioPrestador = str

CloudApiCliModelsNfseResponseNumeroNota = int

CloudApiCliModelsNfseResponseRazaoSocialPrestador = str

CloudApiCliModelsNfseResponseRazaoSocialTomador = str

CloudApiCliModelsNfseResponseUfPrestador = str

CloudApiCliModelsNfseResponseUfTomador = str

CloudApiCliModelsNfseResponseValorLiquidoCentavos = int

CloudApiCliModelsNfseResponseValorTotalCentavos = int


@dataclass
class CloudApiCliModelsNfseResponse:
    bairro_prestador: typing.Optional[CloudApiCliModelsNfseResponseBairroPrestador] = (
        field(default_factory=lambda: None)
    )
    bairro_tomador: typing.Optional[CloudApiCliModelsNfseResponseBairroTomador] = field(
        default_factory=lambda: None
    )
    cep_prestador: typing.Optional[CloudApiCliModelsNfseResponseCepPrestador] = field(
        default_factory=lambda: None
    )
    cep_tomador: typing.Optional[CloudApiCliModelsNfseResponseCepTomador] = field(
        default_factory=lambda: None
    )
    cnpj_prestador: typing.Optional[CloudApiCliModelsNfseResponseCnpjPrestador] = field(
        default_factory=lambda: None
    )
    cnpj_tomador: typing.Optional[CloudApiCliModelsNfseResponseCnpjTomador] = field(
        default_factory=lambda: None
    )
    codigo_servico: typing.Optional[CloudApiCliModelsNfseResponseCodigoServico] = field(
        default_factory=lambda: None
    )
    data_emissao: typing.Optional[CloudApiCliModelsNfseResponseDataEmissao] = field(
        default_factory=lambda: None
    )
    descricao: typing.Optional[CloudApiCliModelsNfseResponseDescricao] = field(
        default_factory=lambda: None
    )
    email_prestador: typing.Optional[CloudApiCliModelsNfseResponseEmailPrestador] = (
        field(default_factory=lambda: None)
    )
    email_tomador: typing.Optional[CloudApiCliModelsNfseResponseEmailTomador] = field(
        default_factory=lambda: None
    )
    endereco_prestador: typing.Optional[
        CloudApiCliModelsNfseResponseEnderecoPrestador
    ] = field(default_factory=lambda: None)
    endereco_tomador: typing.Optional[CloudApiCliModelsNfseResponseEnderecoTomador] = (
        field(default_factory=lambda: None)
    )
    inscricao_municipal_prestador: typing.Optional[
        CloudApiCliModelsNfseResponseInscricaoMunicipalPrestador
    ] = field(default_factory=lambda: None)
    municipio_prestador: typing.Optional[
        CloudApiCliModelsNfseResponseMunicipioPrestador
    ] = field(default_factory=lambda: None)
    numero_nota: typing.Optional[CloudApiCliModelsNfseResponseNumeroNota] = field(
        default_factory=lambda: None
    )
    razao_social_prestador: typing.Optional[
        CloudApiCliModelsNfseResponseRazaoSocialPrestador
    ] = field(default_factory=lambda: None)
    razao_social_tomador: typing.Optional[
        CloudApiCliModelsNfseResponseRazaoSocialTomador
    ] = field(default_factory=lambda: None)
    uf_prestador: typing.Optional[CloudApiCliModelsNfseResponseUfPrestador] = field(
        default_factory=lambda: None
    )
    uf_tomador: typing.Optional[CloudApiCliModelsNfseResponseUfTomador] = field(
        default_factory=lambda: None
    )
    valor_liquido_centavos: typing.Optional[
        CloudApiCliModelsNfseResponseValorLiquidoCentavos
    ] = field(default_factory=lambda: None)
    valor_total_centavos: typing.Optional[
        CloudApiCliModelsNfseResponseValorTotalCentavos
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.bairro_prestador is not None:
            data["bairro_prestador"] = self.bairro_prestador
        if self.bairro_tomador is not None:
            data["bairro_tomador"] = self.bairro_tomador
        if self.cep_prestador is not None:
            data["cep_prestador"] = self.cep_prestador
        if self.cep_tomador is not None:
            data["cep_tomador"] = self.cep_tomador
        if self.cnpj_prestador is not None:
            data["cnpj_prestador"] = self.cnpj_prestador
        if self.cnpj_tomador is not None:
            data["cnpj_tomador"] = self.cnpj_tomador
        if self.codigo_servico is not None:
            data["codigo_servico"] = self.codigo_servico
        if self.data_emissao is not None:
            data["data_emissao"] = self.data_emissao.isoformat()
        if self.descricao is not None:
            data["descricao"] = self.descricao
        if self.email_prestador is not None:
            data["email_prestador"] = self.email_prestador
        if self.email_tomador is not None:
            data["email_tomador"] = self.email_tomador
        if self.endereco_prestador is not None:
            data["endereco_prestador"] = self.endereco_prestador
        if self.endereco_tomador is not None:
            data["endereco_tomador"] = self.endereco_tomador
        if self.inscricao_municipal_prestador is not None:
            data["inscricao_municipal_prestador"] = self.inscricao_municipal_prestador
        if self.municipio_prestador is not None:
            data["municipio_prestador"] = self.municipio_prestador
        if self.numero_nota is not None:
            data["numero_nota"] = self.numero_nota
        if self.razao_social_prestador is not None:
            data["razao_social_prestador"] = self.razao_social_prestador
        if self.razao_social_tomador is not None:
            data["razao_social_tomador"] = self.razao_social_tomador
        if self.uf_prestador is not None:
            data["uf_prestador"] = self.uf_prestador
        if self.uf_tomador is not None:
            data["uf_tomador"] = self.uf_tomador
        if self.valor_liquido_centavos is not None:
            data["valor_liquido_centavos"] = self.valor_liquido_centavos
        if self.valor_total_centavos is not None:
            data["valor_total_centavos"] = self.valor_total_centavos
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsNfseResponse":
        return cls(
            bairro_prestador=None
            if data.get("bairro_prestador") is None
            else str(data["bairro_prestador"]),
            bairro_tomador=None
            if data.get("bairro_tomador") is None
            else str(data["bairro_tomador"]),
            cep_prestador=None
            if data.get("cep_prestador") is None
            else str(data["cep_prestador"]),
            cep_tomador=None
            if data.get("cep_tomador") is None
            else str(data["cep_tomador"]),
            cnpj_prestador=None
            if data.get("cnpj_prestador") is None
            else str(data["cnpj_prestador"]),
            cnpj_tomador=None
            if data.get("cnpj_tomador") is None
            else str(data["cnpj_tomador"]),
            codigo_servico=None
            if data.get("codigo_servico") is None
            else str(data["codigo_servico"]),
            data_emissao=None
            if data.get("data_emissao") is None
            else datetime.date.fromisoformat(data["data_emissao"]),
            descricao=None if data.get("descricao") is None else str(data["descricao"]),
            email_prestador=None
            if data.get("email_prestador") is None
            else str(data["email_prestador"]),
            email_tomador=None
            if data.get("email_tomador") is None
            else str(data["email_tomador"]),
            endereco_prestador=None
            if data.get("endereco_prestador") is None
            else str(data["endereco_prestador"]),
            endereco_tomador=None
            if data.get("endereco_tomador") is None
            else str(data["endereco_tomador"]),
            inscricao_municipal_prestador=None
            if data.get("inscricao_municipal_prestador") is None
            else str(data["inscricao_municipal_prestador"]),
            municipio_prestador=None
            if data.get("municipio_prestador") is None
            else str(data["municipio_prestador"]),
            numero_nota=None
            if data.get("numero_nota") is None
            else int(data["numero_nota"]),
            razao_social_prestador=None
            if data.get("razao_social_prestador") is None
            else str(data["razao_social_prestador"]),
            razao_social_tomador=None
            if data.get("razao_social_tomador") is None
            else str(data["razao_social_tomador"]),
            uf_prestador=None
            if data.get("uf_prestador") is None
            else str(data["uf_prestador"]),
            uf_tomador=None
            if data.get("uf_tomador") is None
            else str(data["uf_tomador"]),
            valor_liquido_centavos=None
            if data.get("valor_liquido_centavos") is None
            else int(data["valor_liquido_centavos"]),
            valor_total_centavos=None
            if data.get("valor_total_centavos") is None
            else int(data["valor_total_centavos"]),
        )


CloudApiCliModelsBoletoResponseAgenciaCodBeneficiario = str

CloudApiCliModelsBoletoResponseBeneficiario = str

CloudApiCliModelsBoletoResponseCarteira = str

CloudApiCliModelsBoletoResponseCpfCnpjBeneficiario = str

CloudApiCliModelsBoletoResponseCpfCnpjPagador = str

CloudApiCliModelsBoletoResponseCodigoDeBarras = str

CloudApiCliModelsBoletoResponseDataEmissao = datetime.date

CloudApiCliModelsBoletoResponseDataProcessamento = datetime.date

CloudApiCliModelsBoletoResponseEnderecoBeneficiario = str

CloudApiCliModelsBoletoResponseEnderecoPagador = str

CloudApiCliModelsBoletoResponseNossoNumero = str

CloudApiCliModelsBoletoResponseNumeroDocumento = str

CloudApiCliModelsBoletoResponsePagador = str

CloudApiCliModelsBoletoResponseValor = int

CloudApiCliModelsBoletoResponseVencimento = datetime.date


@dataclass
class CloudApiCliModelsBoletoResponse:
    agencia_cod_beneficiario: typing.Optional[
        CloudApiCliModelsBoletoResponseAgenciaCodBeneficiario
    ] = field(default_factory=lambda: None)
    beneficiario: typing.Optional[CloudApiCliModelsBoletoResponseBeneficiario] = field(
        default_factory=lambda: None
    )
    carteira: typing.Optional[CloudApiCliModelsBoletoResponseCarteira] = field(
        default_factory=lambda: None
    )
    cpf_cnpj_beneficiario: typing.Optional[
        CloudApiCliModelsBoletoResponseCpfCnpjBeneficiario
    ] = field(default_factory=lambda: None)
    cpf_cnpj_pagador: typing.Optional[CloudApiCliModelsBoletoResponseCpfCnpjPagador] = (
        field(default_factory=lambda: None)
    )
    codigo_de_barras: typing.Optional[CloudApiCliModelsBoletoResponseCodigoDeBarras] = (
        field(default_factory=lambda: None)
    )
    data_emissao: typing.Optional[CloudApiCliModelsBoletoResponseDataEmissao] = field(
        default_factory=lambda: None
    )
    data_processamento: typing.Optional[
        CloudApiCliModelsBoletoResponseDataProcessamento
    ] = field(default_factory=lambda: None)
    endereco_beneficiario: typing.Optional[
        CloudApiCliModelsBoletoResponseEnderecoBeneficiario
    ] = field(default_factory=lambda: None)
    endereco_pagador: typing.Optional[
        CloudApiCliModelsBoletoResponseEnderecoPagador
    ] = field(default_factory=lambda: None)
    nosso_numero: typing.Optional[CloudApiCliModelsBoletoResponseNossoNumero] = field(
        default_factory=lambda: None
    )
    numero_documento: typing.Optional[
        CloudApiCliModelsBoletoResponseNumeroDocumento
    ] = field(default_factory=lambda: None)
    pagador: typing.Optional[CloudApiCliModelsBoletoResponsePagador] = field(
        default_factory=lambda: None
    )
    valor: typing.Optional[CloudApiCliModelsBoletoResponseValor] = field(
        default_factory=lambda: None
    )
    vencimento: typing.Optional[CloudApiCliModelsBoletoResponseVencimento] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.agencia_cod_beneficiario is not None:
            data["agencia_cod_beneficiario"] = self.agencia_cod_beneficiario
        if self.beneficiario is not None:
            data["beneficiario"] = self.beneficiario
        if self.carteira is not None:
            data["carteira"] = self.carteira
        if self.cpf_cnpj_beneficiario is not None:
            data["cpf_cnpj_beneficiario"] = self.cpf_cnpj_beneficiario
        if self.cpf_cnpj_pagador is not None:
            data["cpf_cnpj_pagador"] = self.cpf_cnpj_pagador
        if self.codigo_de_barras is not None:
            data["codigo_de_barras"] = self.codigo_de_barras
        if self.data_emissao is not None:
            data["data_emissao"] = self.data_emissao.isoformat()
        if self.data_processamento is not None:
            data["data_processamento"] = self.data_processamento.isoformat()
        if self.endereco_beneficiario is not None:
            data["endereco_beneficiario"] = self.endereco_beneficiario
        if self.endereco_pagador is not None:
            data["endereco_pagador"] = self.endereco_pagador
        if self.nosso_numero is not None:
            data["nosso_numero"] = self.nosso_numero
        if self.numero_documento is not None:
            data["numero_documento"] = self.numero_documento
        if self.pagador is not None:
            data["pagador"] = self.pagador
        if self.valor is not None:
            data["valor"] = self.valor
        if self.vencimento is not None:
            data["vencimento"] = self.vencimento.isoformat()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsBoletoResponse":
        return cls(
            agencia_cod_beneficiario=None
            if data.get("agencia_cod_beneficiario") is None
            else str(data["agencia_cod_beneficiario"]),
            beneficiario=None
            if data.get("beneficiario") is None
            else str(data["beneficiario"]),
            carteira=None if data.get("carteira") is None else str(data["carteira"]),
            cpf_cnpj_beneficiario=None
            if data.get("cpf_cnpj_beneficiario") is None
            else str(data["cpf_cnpj_beneficiario"]),
            cpf_cnpj_pagador=None
            if data.get("cpf_cnpj_pagador") is None
            else str(data["cpf_cnpj_pagador"]),
            codigo_de_barras=None
            if data.get("codigo_de_barras") is None
            else str(data["codigo_de_barras"]),
            data_emissao=None
            if data.get("data_emissao") is None
            else datetime.date.fromisoformat(data["data_emissao"]),
            data_processamento=None
            if data.get("data_processamento") is None
            else datetime.date.fromisoformat(data["data_processamento"]),
            endereco_beneficiario=None
            if data.get("endereco_beneficiario") is None
            else str(data["endereco_beneficiario"]),
            endereco_pagador=None
            if data.get("endereco_pagador") is None
            else str(data["endereco_pagador"]),
            nosso_numero=None
            if data.get("nosso_numero") is None
            else str(data["nosso_numero"]),
            numero_documento=None
            if data.get("numero_documento") is None
            else str(data["numero_documento"]),
            pagador=None if data.get("pagador") is None else str(data["pagador"]),
            valor=None if data.get("valor") is None else int(data["valor"]),
            vencimento=None
            if data.get("vencimento") is None
            else datetime.date.fromisoformat(data["vencimento"]),
        )


CloudApiCliModelsBankStatementResponseAccountNumber = str

CloudApiCliModelsBankStatementResponseStartingBalance = str

CloudApiCliModelsBankStatementResponseEndingBalance = str

CloudApiCliModelsBankStatementResponseStatementStartDate = datetime.date

CloudApiCliModelsBankStatementResponseStatementEndDate = datetime.date

CloudApiCliModelsBankStatementResponseClientName = str

CloudApiCliModelsBankStatementResponseClientAddress = str

CloudApiCliModelsBankStatementResponseAccountType = str

CloudApiCliModelsBankStatementResponseBankName = str

CloudApiCliModelsBankStatementResponseBankAddress = str


@dataclass
class CloudApiCliModelsBankStatementResponse:
    account_number: typing.Optional[
        CloudApiCliModelsBankStatementResponseAccountNumber
    ] = field(default_factory=lambda: None)
    starting_balance: typing.Optional[
        CloudApiCliModelsBankStatementResponseStartingBalance
    ] = field(default_factory=lambda: None)
    ending_balance: typing.Optional[
        CloudApiCliModelsBankStatementResponseEndingBalance
    ] = field(default_factory=lambda: None)
    statement_start_date: typing.Optional[
        CloudApiCliModelsBankStatementResponseStatementStartDate
    ] = field(default_factory=lambda: None)
    statement_end_date: typing.Optional[
        CloudApiCliModelsBankStatementResponseStatementEndDate
    ] = field(default_factory=lambda: None)
    client_name: typing.Optional[CloudApiCliModelsBankStatementResponseClientName] = (
        field(default_factory=lambda: None)
    )
    client_address: typing.Optional[
        CloudApiCliModelsBankStatementResponseClientAddress
    ] = field(default_factory=lambda: None)
    account_type: typing.Optional[CloudApiCliModelsBankStatementResponseAccountType] = (
        field(default_factory=lambda: None)
    )
    bank_name: typing.Optional[CloudApiCliModelsBankStatementResponseBankName] = field(
        default_factory=lambda: None
    )
    bank_address: typing.Optional[CloudApiCliModelsBankStatementResponseBankAddress] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.account_number is not None:
            data["account_number"] = self.account_number
        if self.starting_balance is not None:
            data["starting_balance"] = self.starting_balance
        if self.ending_balance is not None:
            data["ending_balance"] = self.ending_balance
        if self.statement_start_date is not None:
            data["statement_start_date"] = self.statement_start_date.isoformat()
        if self.statement_end_date is not None:
            data["statement_end_date"] = self.statement_end_date.isoformat()
        if self.client_name is not None:
            data["client_name"] = self.client_name
        if self.client_address is not None:
            data["client_address"] = self.client_address
        if self.account_type is not None:
            data["account_type"] = self.account_type
        if self.bank_name is not None:
            data["bank_name"] = self.bank_name
        if self.bank_address is not None:
            data["bank_address"] = self.bank_address
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsBankStatementResponse":
        return cls(
            account_number=None
            if data.get("account_number") is None
            else str(data["account_number"]),
            starting_balance=None
            if data.get("starting_balance") is None
            else str(data["starting_balance"]),
            ending_balance=None
            if data.get("ending_balance") is None
            else str(data["ending_balance"]),
            statement_start_date=None
            if data.get("statement_start_date") is None
            else datetime.date.fromisoformat(data["statement_start_date"]),
            statement_end_date=None
            if data.get("statement_end_date") is None
            else datetime.date.fromisoformat(data["statement_end_date"]),
            client_name=None
            if data.get("client_name") is None
            else str(data["client_name"]),
            client_address=None
            if data.get("client_address") is None
            else str(data["client_address"]),
            account_type=None
            if data.get("account_type") is None
            else str(data["account_type"]),
            bank_name=None if data.get("bank_name") is None else str(data["bank_name"]),
            bank_address=None
            if data.get("bank_address") is None
            else str(data["bank_address"]),
        )


CloudApiCliModelsUsDriverLicenseResponseAddress = str

CloudApiCliModelsUsDriverLicenseResponseDateOfBirth = datetime.date

CloudApiCliModelsUsDriverLicenseResponseDocumentId = str

CloudApiCliModelsUsDriverLicenseResponseExpirationDate = datetime.date

CloudApiCliModelsUsDriverLicenseResponseFamilyName = str

CloudApiCliModelsUsDriverLicenseResponseGivenNames = str

CloudApiCliModelsUsDriverLicenseResponseIssueDate = datetime.date


@dataclass
class CloudApiCliModelsUsDriverLicenseResponse:
    address: typing.Optional[CloudApiCliModelsUsDriverLicenseResponseAddress] = field(
        default_factory=lambda: None
    )
    date_of_birth: typing.Optional[
        CloudApiCliModelsUsDriverLicenseResponseDateOfBirth
    ] = field(default_factory=lambda: None)
    document_id: typing.Optional[CloudApiCliModelsUsDriverLicenseResponseDocumentId] = (
        field(default_factory=lambda: None)
    )
    expiration_date: typing.Optional[
        CloudApiCliModelsUsDriverLicenseResponseExpirationDate
    ] = field(default_factory=lambda: None)
    family_name: typing.Optional[CloudApiCliModelsUsDriverLicenseResponseFamilyName] = (
        field(default_factory=lambda: None)
    )
    given_names: typing.Optional[CloudApiCliModelsUsDriverLicenseResponseGivenNames] = (
        field(default_factory=lambda: None)
    )
    issue_date: typing.Optional[CloudApiCliModelsUsDriverLicenseResponseIssueDate] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.address is not None:
            data["address"] = self.address
        if self.date_of_birth is not None:
            data["date_of_birth"] = self.date_of_birth.isoformat()
        if self.document_id is not None:
            data["document_id"] = self.document_id
        if self.expiration_date is not None:
            data["expiration_date"] = self.expiration_date.isoformat()
        if self.family_name is not None:
            data["family_name"] = self.family_name
        if self.given_names is not None:
            data["given_names"] = self.given_names
        if self.issue_date is not None:
            data["issue_date"] = self.issue_date.isoformat()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsUsDriverLicenseResponse":
        return cls(
            address=None if data.get("address") is None else str(data["address"]),
            date_of_birth=None
            if data.get("date_of_birth") is None
            else datetime.date.fromisoformat(data["date_of_birth"]),
            document_id=None
            if data.get("document_id") is None
            else str(data["document_id"]),
            expiration_date=None
            if data.get("expiration_date") is None
            else datetime.date.fromisoformat(data["expiration_date"]),
            family_name=None
            if data.get("family_name") is None
            else str(data["family_name"]),
            given_names=None
            if data.get("given_names") is None
            else str(data["given_names"]),
            issue_date=None
            if data.get("issue_date") is None
            else datetime.date.fromisoformat(data["issue_date"]),
        )


CloudApiCliModelsNfeResponseAliquotaIcms = float

CloudApiCliModelsNfeResponseAliquotaIpi = float

CloudApiCliModelsNfeResponseBairroDistritoDestinatario = str

CloudApiCliModelsNfeResponseBairroEmitente = str

CloudApiCliModelsNfeResponseBaseCalculoIcms = float

CloudApiCliModelsNfeResponseBaseCalculoIcmsSt = float

CloudApiCliModelsNfeResponseBaseIssqn = str

CloudApiCliModelsNfeResponseCepDestinatario = str

CloudApiCliModelsNfeResponseCepEmitente = str

CloudApiCliModelsNfeResponseCfop = str

CloudApiCliModelsNfeResponseChaveAcesso = str

CloudApiCliModelsNfeResponseCnpjEmitente = str

CloudApiCliModelsNfeResponseCnpjTransportadora = str

CloudApiCliModelsNfeResponseCodigoAntt = str

CloudApiCliModelsNfeResponseCodigoProduto = str

CloudApiCliModelsNfeResponseCpfCnpjDestinatario = str

CloudApiCliModelsNfeResponseCst = str

CloudApiCliModelsNfeResponseDataEmissao = datetime.datetime

CloudApiCliModelsNfeResponseDataEntradaSaida = str

CloudApiCliModelsNfeResponseDataProtocoloAutorizacao = datetime.datetime

CloudApiCliModelsNfeResponseDesconto = float

CloudApiCliModelsNfeResponseDescricaoProduto = str

CloudApiCliModelsNfeResponseEnderecoDestinatario = str

CloudApiCliModelsNfeResponseEnderecoEmitente = str

CloudApiCliModelsNfeResponseEnderecoTransportadora = str

CloudApiCliModelsNfeResponseEspecie = str

CloudApiCliModelsNfeResponseFretePorConta = str

CloudApiCliModelsNfeResponseHoraSaida = str

CloudApiCliModelsNfeResponseInformacoesAdicionais = str

CloudApiCliModelsNfeResponseInscricaoEstadualDestinatario = str

CloudApiCliModelsNfeResponseInscricaoEstadualEmitente = str

CloudApiCliModelsNfeResponseInscricaoEstadualSubstitutoTributario = str

CloudApiCliModelsNfeResponseInscricaoEstadualTransportadora = str

CloudApiCliModelsNfeResponseInscricaoMunicipal = float

CloudApiCliModelsNfeResponseMarcaVolumes = str

CloudApiCliModelsNfeResponseMunicipioDestinatario = str

CloudApiCliModelsNfeResponseMunicipioEmitente = str

CloudApiCliModelsNfeResponseMunicipioTransportadora = str

CloudApiCliModelsNfeResponseNaturezaOperacao = str

CloudApiCliModelsNfeResponseNcmSh = str

CloudApiCliModelsNfeResponseNomeDestinatario = str

CloudApiCliModelsNfeResponseNumeroNota = str

CloudApiCliModelsNfeResponseNumeroVolumes = str

CloudApiCliModelsNfeResponseOutrasDespesas = float

CloudApiCliModelsNfeResponsePesoBrutoKg = float

CloudApiCliModelsNfeResponsePesoLiquidoKg = float

CloudApiCliModelsNfeResponsePlacaVeiculo = str

CloudApiCliModelsNfeResponseProtocoloAutorizacao = str

CloudApiCliModelsNfeResponseQuantidade = str

CloudApiCliModelsNfeResponseQuantidadeVolumes = str

CloudApiCliModelsNfeResponseRazaoSocialDestinatario = str

CloudApiCliModelsNfeResponseRazaoSocialEmitente = str

CloudApiCliModelsNfeResponseRazaoSocialTransportadora = str

CloudApiCliModelsNfeResponseSerie = str

CloudApiCliModelsNfeResponseTelefoneDestinatario = str

CloudApiCliModelsNfeResponseTelefoneEmitente = str

CloudApiCliModelsNfeResponseUfDestinatario = str

CloudApiCliModelsNfeResponseUfEmitente = str

CloudApiCliModelsNfeResponseUfTransportadora = str

CloudApiCliModelsNfeResponseUfVeiculo = str

CloudApiCliModelsNfeResponseUnidade = str

CloudApiCliModelsNfeResponseValorFcpSt = float

CloudApiCliModelsNfeResponseValorFrete = float

CloudApiCliModelsNfeResponseValorIcms = float

CloudApiCliModelsNfeResponseValorIcmsSt = float

CloudApiCliModelsNfeResponseValorIpi = float

CloudApiCliModelsNfeResponseValorIssqn = float

CloudApiCliModelsNfeResponseValorProdutos = float

CloudApiCliModelsNfeResponseValorSeguro = float

CloudApiCliModelsNfeResponseValorTotal = float

CloudApiCliModelsNfeResponseValorTributos = float

CloudApiCliModelsNfeResponseValorUnitario = float


@dataclass
class CloudApiCliModelsNfeResponse:
    aliquota_icms: typing.Optional[CloudApiCliModelsNfeResponseAliquotaIcms] = field(
        default_factory=lambda: None
    )
    aliquota_ipi: typing.Optional[CloudApiCliModelsNfeResponseAliquotaIpi] = field(
        default_factory=lambda: None
    )
    bairro_distrito_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseBairroDistritoDestinatario
    ] = field(default_factory=lambda: None)
    bairro_emitente: typing.Optional[CloudApiCliModelsNfeResponseBairroEmitente] = (
        field(default_factory=lambda: None)
    )
    base_calculo_icms: typing.Optional[CloudApiCliModelsNfeResponseBaseCalculoIcms] = (
        field(default_factory=lambda: None)
    )
    base_calculo_icms_st: typing.Optional[
        CloudApiCliModelsNfeResponseBaseCalculoIcmsSt
    ] = field(default_factory=lambda: None)
    base_issqn: typing.Optional[CloudApiCliModelsNfeResponseBaseIssqn] = field(
        default_factory=lambda: None
    )
    cep_destinatario: typing.Optional[CloudApiCliModelsNfeResponseCepDestinatario] = (
        field(default_factory=lambda: None)
    )
    cep_emitente: typing.Optional[CloudApiCliModelsNfeResponseCepEmitente] = field(
        default_factory=lambda: None
    )
    cfop: typing.Optional[CloudApiCliModelsNfeResponseCfop] = field(
        default_factory=lambda: None
    )
    chave_acesso: typing.Optional[CloudApiCliModelsNfeResponseChaveAcesso] = field(
        default_factory=lambda: None
    )
    cnpj_emitente: typing.Optional[CloudApiCliModelsNfeResponseCnpjEmitente] = field(
        default_factory=lambda: None
    )
    cnpj_transportadora: typing.Optional[
        CloudApiCliModelsNfeResponseCnpjTransportadora
    ] = field(default_factory=lambda: None)
    codigo_antt: typing.Optional[CloudApiCliModelsNfeResponseCodigoAntt] = field(
        default_factory=lambda: None
    )
    codigo_produto: typing.Optional[CloudApiCliModelsNfeResponseCodigoProduto] = field(
        default_factory=lambda: None
    )
    cpf_cnpj_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseCpfCnpjDestinatario
    ] = field(default_factory=lambda: None)
    cst: typing.Optional[CloudApiCliModelsNfeResponseCst] = field(
        default_factory=lambda: None
    )
    data_emissao: typing.Optional[CloudApiCliModelsNfeResponseDataEmissao] = field(
        default_factory=lambda: None
    )
    data_entrada_saida: typing.Optional[
        CloudApiCliModelsNfeResponseDataEntradaSaida
    ] = field(default_factory=lambda: None)
    data_protocolo_autorizacao: typing.Optional[
        CloudApiCliModelsNfeResponseDataProtocoloAutorizacao
    ] = field(default_factory=lambda: None)
    desconto: typing.Optional[CloudApiCliModelsNfeResponseDesconto] = field(
        default_factory=lambda: None
    )
    descricao_produto: typing.Optional[CloudApiCliModelsNfeResponseDescricaoProduto] = (
        field(default_factory=lambda: None)
    )
    endereco_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseEnderecoDestinatario
    ] = field(default_factory=lambda: None)
    endereco_emitente: typing.Optional[CloudApiCliModelsNfeResponseEnderecoEmitente] = (
        field(default_factory=lambda: None)
    )
    endereco_transportadora: typing.Optional[
        CloudApiCliModelsNfeResponseEnderecoTransportadora
    ] = field(default_factory=lambda: None)
    especie: typing.Optional[CloudApiCliModelsNfeResponseEspecie] = field(
        default_factory=lambda: None
    )
    frete_por_conta: typing.Optional[CloudApiCliModelsNfeResponseFretePorConta] = field(
        default_factory=lambda: None
    )
    hora_saida: typing.Optional[CloudApiCliModelsNfeResponseHoraSaida] = field(
        default_factory=lambda: None
    )
    informacoes_adicionais: typing.Optional[
        CloudApiCliModelsNfeResponseInformacoesAdicionais
    ] = field(default_factory=lambda: None)
    inscricao_estadual_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseInscricaoEstadualDestinatario
    ] = field(default_factory=lambda: None)
    inscricao_estadual_emitente: typing.Optional[
        CloudApiCliModelsNfeResponseInscricaoEstadualEmitente
    ] = field(default_factory=lambda: None)
    inscricao_estadual_substituto_tributario: typing.Optional[
        CloudApiCliModelsNfeResponseInscricaoEstadualSubstitutoTributario
    ] = field(default_factory=lambda: None)
    inscricao_estadual_transportadora: typing.Optional[
        CloudApiCliModelsNfeResponseInscricaoEstadualTransportadora
    ] = field(default_factory=lambda: None)
    inscricao_municipal: typing.Optional[
        CloudApiCliModelsNfeResponseInscricaoMunicipal
    ] = field(default_factory=lambda: None)
    marca_volumes: typing.Optional[CloudApiCliModelsNfeResponseMarcaVolumes] = field(
        default_factory=lambda: None
    )
    municipio_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseMunicipioDestinatario
    ] = field(default_factory=lambda: None)
    municipio_emitente: typing.Optional[
        CloudApiCliModelsNfeResponseMunicipioEmitente
    ] = field(default_factory=lambda: None)
    municipio_transportadora: typing.Optional[
        CloudApiCliModelsNfeResponseMunicipioTransportadora
    ] = field(default_factory=lambda: None)
    natureza_operacao: typing.Optional[CloudApiCliModelsNfeResponseNaturezaOperacao] = (
        field(default_factory=lambda: None)
    )
    ncm_sh: typing.Optional[CloudApiCliModelsNfeResponseNcmSh] = field(
        default_factory=lambda: None
    )
    nome_destinatario: typing.Optional[CloudApiCliModelsNfeResponseNomeDestinatario] = (
        field(default_factory=lambda: None)
    )
    numero_nota: typing.Optional[CloudApiCliModelsNfeResponseNumeroNota] = field(
        default_factory=lambda: None
    )
    numero_volumes: typing.Optional[CloudApiCliModelsNfeResponseNumeroVolumes] = field(
        default_factory=lambda: None
    )
    outras_despesas: typing.Optional[CloudApiCliModelsNfeResponseOutrasDespesas] = (
        field(default_factory=lambda: None)
    )
    peso_bruto_kg: typing.Optional[CloudApiCliModelsNfeResponsePesoBrutoKg] = field(
        default_factory=lambda: None
    )
    peso_liquido_kg: typing.Optional[CloudApiCliModelsNfeResponsePesoLiquidoKg] = field(
        default_factory=lambda: None
    )
    placa_veiculo: typing.Optional[CloudApiCliModelsNfeResponsePlacaVeiculo] = field(
        default_factory=lambda: None
    )
    protocolo_autorizacao: typing.Optional[
        CloudApiCliModelsNfeResponseProtocoloAutorizacao
    ] = field(default_factory=lambda: None)
    quantidade: typing.Optional[CloudApiCliModelsNfeResponseQuantidade] = field(
        default_factory=lambda: None
    )
    quantidade_volumes: typing.Optional[
        CloudApiCliModelsNfeResponseQuantidadeVolumes
    ] = field(default_factory=lambda: None)
    razao_social_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseRazaoSocialDestinatario
    ] = field(default_factory=lambda: None)
    razao_social_emitente: typing.Optional[
        CloudApiCliModelsNfeResponseRazaoSocialEmitente
    ] = field(default_factory=lambda: None)
    razao_social_transportadora: typing.Optional[
        CloudApiCliModelsNfeResponseRazaoSocialTransportadora
    ] = field(default_factory=lambda: None)
    serie: typing.Optional[CloudApiCliModelsNfeResponseSerie] = field(
        default_factory=lambda: None
    )
    telefone_destinatario: typing.Optional[
        CloudApiCliModelsNfeResponseTelefoneDestinatario
    ] = field(default_factory=lambda: None)
    telefone_emitente: typing.Optional[CloudApiCliModelsNfeResponseTelefoneEmitente] = (
        field(default_factory=lambda: None)
    )
    uf_destinatario: typing.Optional[CloudApiCliModelsNfeResponseUfDestinatario] = (
        field(default_factory=lambda: None)
    )
    uf_emitente: typing.Optional[CloudApiCliModelsNfeResponseUfEmitente] = field(
        default_factory=lambda: None
    )
    uf_transportadora: typing.Optional[CloudApiCliModelsNfeResponseUfTransportadora] = (
        field(default_factory=lambda: None)
    )
    uf_veiculo: typing.Optional[CloudApiCliModelsNfeResponseUfVeiculo] = field(
        default_factory=lambda: None
    )
    unidade: typing.Optional[CloudApiCliModelsNfeResponseUnidade] = field(
        default_factory=lambda: None
    )
    valor_fcp_st: typing.Optional[CloudApiCliModelsNfeResponseValorFcpSt] = field(
        default_factory=lambda: None
    )
    valor_frete: typing.Optional[CloudApiCliModelsNfeResponseValorFrete] = field(
        default_factory=lambda: None
    )
    valor_icms: typing.Optional[CloudApiCliModelsNfeResponseValorIcms] = field(
        default_factory=lambda: None
    )
    valor_icms_st: typing.Optional[CloudApiCliModelsNfeResponseValorIcmsSt] = field(
        default_factory=lambda: None
    )
    valor_ipi: typing.Optional[CloudApiCliModelsNfeResponseValorIpi] = field(
        default_factory=lambda: None
    )
    valor_issqn: typing.Optional[CloudApiCliModelsNfeResponseValorIssqn] = field(
        default_factory=lambda: None
    )
    valor_produtos: typing.Optional[CloudApiCliModelsNfeResponseValorProdutos] = field(
        default_factory=lambda: None
    )
    valor_seguro: typing.Optional[CloudApiCliModelsNfeResponseValorSeguro] = field(
        default_factory=lambda: None
    )
    valor_total: typing.Optional[CloudApiCliModelsNfeResponseValorTotal] = field(
        default_factory=lambda: None
    )
    valor_tributos: typing.Optional[CloudApiCliModelsNfeResponseValorTributos] = field(
        default_factory=lambda: None
    )
    valor_unitario: typing.Optional[CloudApiCliModelsNfeResponseValorUnitario] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.aliquota_icms is not None:
            data["aliquota_icms"] = self.aliquota_icms
        if self.aliquota_ipi is not None:
            data["aliquota_ipi"] = self.aliquota_ipi
        if self.bairro_distrito_destinatario is not None:
            data["bairro_distrito_destinatario"] = self.bairro_distrito_destinatario
        if self.bairro_emitente is not None:
            data["bairro_emitente"] = self.bairro_emitente
        if self.base_calculo_icms is not None:
            data["base_calculo_icms"] = self.base_calculo_icms
        if self.base_calculo_icms_st is not None:
            data["base_calculo_icms_st"] = self.base_calculo_icms_st
        if self.base_issqn is not None:
            data["base_issqn"] = self.base_issqn
        if self.cep_destinatario is not None:
            data["cep_destinatario"] = self.cep_destinatario
        if self.cep_emitente is not None:
            data["cep_emitente"] = self.cep_emitente
        if self.cfop is not None:
            data["cfop"] = self.cfop
        if self.chave_acesso is not None:
            data["chave_acesso"] = self.chave_acesso
        if self.cnpj_emitente is not None:
            data["cnpj_emitente"] = self.cnpj_emitente
        if self.cnpj_transportadora is not None:
            data["cnpj_transportadora"] = self.cnpj_transportadora
        if self.codigo_antt is not None:
            data["codigo_antt"] = self.codigo_antt
        if self.codigo_produto is not None:
            data["codigo_produto"] = self.codigo_produto
        if self.cpf_cnpj_destinatario is not None:
            data["cpf_cnpj_destinatario"] = self.cpf_cnpj_destinatario
        if self.cst is not None:
            data["cst"] = self.cst
        if self.data_emissao is not None:
            data["data_emissao"] = self.data_emissao.isoformat()
        if self.data_entrada_saida is not None:
            data["data_entrada_saida"] = self.data_entrada_saida
        if self.data_protocolo_autorizacao is not None:
            data["data_protocolo_autorizacao"] = (
                self.data_protocolo_autorizacao.isoformat()
            )
        if self.desconto is not None:
            data["desconto"] = self.desconto
        if self.descricao_produto is not None:
            data["descricao_produto"] = self.descricao_produto
        if self.endereco_destinatario is not None:
            data["endereco_destinatario"] = self.endereco_destinatario
        if self.endereco_emitente is not None:
            data["endereco_emitente"] = self.endereco_emitente
        if self.endereco_transportadora is not None:
            data["endereco_transportadora"] = self.endereco_transportadora
        if self.especie is not None:
            data["especie"] = self.especie
        if self.frete_por_conta is not None:
            data["frete_por_conta"] = self.frete_por_conta
        if self.hora_saida is not None:
            data["hora_saida"] = self.hora_saida
        if self.informacoes_adicionais is not None:
            data["informacoes_adicionais"] = self.informacoes_adicionais
        if self.inscricao_estadual_destinatario is not None:
            data["inscricao_estadual_destinatario"] = (
                self.inscricao_estadual_destinatario
            )
        if self.inscricao_estadual_emitente is not None:
            data["inscricao_estadual_emitente"] = self.inscricao_estadual_emitente
        if self.inscricao_estadual_substituto_tributario is not None:
            data["inscricao_estadual_substituto_tributario"] = (
                self.inscricao_estadual_substituto_tributario
            )
        if self.inscricao_estadual_transportadora is not None:
            data["inscricao_estadual_transportadora"] = (
                self.inscricao_estadual_transportadora
            )
        if self.inscricao_municipal is not None:
            data["inscricao_municipal"] = self.inscricao_municipal
        if self.marca_volumes is not None:
            data["marca_volumes"] = self.marca_volumes
        if self.municipio_destinatario is not None:
            data["municipio_destinatario"] = self.municipio_destinatario
        if self.municipio_emitente is not None:
            data["municipio_emitente"] = self.municipio_emitente
        if self.municipio_transportadora is not None:
            data["municipio_transportadora"] = self.municipio_transportadora
        if self.natureza_operacao is not None:
            data["natureza_operacao"] = self.natureza_operacao
        if self.ncm_sh is not None:
            data["ncm_sh"] = self.ncm_sh
        if self.nome_destinatario is not None:
            data["nome_destinatario"] = self.nome_destinatario
        if self.numero_nota is not None:
            data["numero_nota"] = self.numero_nota
        if self.numero_volumes is not None:
            data["numero_volumes"] = self.numero_volumes
        if self.outras_despesas is not None:
            data["outras_despesas"] = self.outras_despesas
        if self.peso_bruto_kg is not None:
            data["peso_bruto_kg"] = self.peso_bruto_kg
        if self.peso_liquido_kg is not None:
            data["peso_liquido_kg"] = self.peso_liquido_kg
        if self.placa_veiculo is not None:
            data["placa_veiculo"] = self.placa_veiculo
        if self.protocolo_autorizacao is not None:
            data["protocolo_autorizacao"] = self.protocolo_autorizacao
        if self.quantidade is not None:
            data["quantidade"] = self.quantidade
        if self.quantidade_volumes is not None:
            data["quantidade_volumes"] = self.quantidade_volumes
        if self.razao_social_destinatario is not None:
            data["razao_social_destinatario"] = self.razao_social_destinatario
        if self.razao_social_emitente is not None:
            data["razao_social_emitente"] = self.razao_social_emitente
        if self.razao_social_transportadora is not None:
            data["razao_social_transportadora"] = self.razao_social_transportadora
        if self.serie is not None:
            data["serie"] = self.serie
        if self.telefone_destinatario is not None:
            data["telefone_destinatario"] = self.telefone_destinatario
        if self.telefone_emitente is not None:
            data["telefone_emitente"] = self.telefone_emitente
        if self.uf_destinatario is not None:
            data["uf_destinatario"] = self.uf_destinatario
        if self.uf_emitente is not None:
            data["uf_emitente"] = self.uf_emitente
        if self.uf_transportadora is not None:
            data["uf_transportadora"] = self.uf_transportadora
        if self.uf_veiculo is not None:
            data["uf_veiculo"] = self.uf_veiculo
        if self.unidade is not None:
            data["unidade"] = self.unidade
        if self.valor_fcp_st is not None:
            data["valor_fcp_st"] = self.valor_fcp_st
        if self.valor_frete is not None:
            data["valor_frete"] = self.valor_frete
        if self.valor_icms is not None:
            data["valor_icms"] = self.valor_icms
        if self.valor_icms_st is not None:
            data["valor_icms_st"] = self.valor_icms_st
        if self.valor_ipi is not None:
            data["valor_ipi"] = self.valor_ipi
        if self.valor_issqn is not None:
            data["valor_issqn"] = self.valor_issqn
        if self.valor_produtos is not None:
            data["valor_produtos"] = self.valor_produtos
        if self.valor_seguro is not None:
            data["valor_seguro"] = self.valor_seguro
        if self.valor_total is not None:
            data["valor_total"] = self.valor_total
        if self.valor_tributos is not None:
            data["valor_tributos"] = self.valor_tributos
        if self.valor_unitario is not None:
            data["valor_unitario"] = self.valor_unitario
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsNfeResponse":
        return cls(
            aliquota_icms=None
            if data.get("aliquota_icms") is None
            else float(data["aliquota_icms"]),
            aliquota_ipi=None
            if data.get("aliquota_ipi") is None
            else float(data["aliquota_ipi"]),
            bairro_distrito_destinatario=None
            if data.get("bairro_distrito_destinatario") is None
            else str(data["bairro_distrito_destinatario"]),
            bairro_emitente=None
            if data.get("bairro_emitente") is None
            else str(data["bairro_emitente"]),
            base_calculo_icms=None
            if data.get("base_calculo_icms") is None
            else float(data["base_calculo_icms"]),
            base_calculo_icms_st=None
            if data.get("base_calculo_icms_st") is None
            else float(data["base_calculo_icms_st"]),
            base_issqn=None
            if data.get("base_issqn") is None
            else str(data["base_issqn"]),
            cep_destinatario=None
            if data.get("cep_destinatario") is None
            else str(data["cep_destinatario"]),
            cep_emitente=None
            if data.get("cep_emitente") is None
            else str(data["cep_emitente"]),
            cfop=None if data.get("cfop") is None else str(data["cfop"]),
            chave_acesso=None
            if data.get("chave_acesso") is None
            else str(data["chave_acesso"]),
            cnpj_emitente=None
            if data.get("cnpj_emitente") is None
            else str(data["cnpj_emitente"]),
            cnpj_transportadora=None
            if data.get("cnpj_transportadora") is None
            else str(data["cnpj_transportadora"]),
            codigo_antt=None
            if data.get("codigo_antt") is None
            else str(data["codigo_antt"]),
            codigo_produto=None
            if data.get("codigo_produto") is None
            else str(data["codigo_produto"]),
            cpf_cnpj_destinatario=None
            if data.get("cpf_cnpj_destinatario") is None
            else str(data["cpf_cnpj_destinatario"]),
            cst=None if data.get("cst") is None else str(data["cst"]),
            data_emissao=None
            if data.get("data_emissao") is None
            else datetime.datetime.fromisoformat(data["data_emissao"]),
            data_entrada_saida=None
            if data.get("data_entrada_saida") is None
            else str(data["data_entrada_saida"]),
            data_protocolo_autorizacao=None
            if data.get("data_protocolo_autorizacao") is None
            else datetime.datetime.fromisoformat(data["data_protocolo_autorizacao"]),
            desconto=None if data.get("desconto") is None else float(data["desconto"]),
            descricao_produto=None
            if data.get("descricao_produto") is None
            else str(data["descricao_produto"]),
            endereco_destinatario=None
            if data.get("endereco_destinatario") is None
            else str(data["endereco_destinatario"]),
            endereco_emitente=None
            if data.get("endereco_emitente") is None
            else str(data["endereco_emitente"]),
            endereco_transportadora=None
            if data.get("endereco_transportadora") is None
            else str(data["endereco_transportadora"]),
            especie=None if data.get("especie") is None else str(data["especie"]),
            frete_por_conta=None
            if data.get("frete_por_conta") is None
            else str(data["frete_por_conta"]),
            hora_saida=None
            if data.get("hora_saida") is None
            else str(data["hora_saida"]),
            informacoes_adicionais=None
            if data.get("informacoes_adicionais") is None
            else str(data["informacoes_adicionais"]),
            inscricao_estadual_destinatario=None
            if data.get("inscricao_estadual_destinatario") is None
            else str(data["inscricao_estadual_destinatario"]),
            inscricao_estadual_emitente=None
            if data.get("inscricao_estadual_emitente") is None
            else str(data["inscricao_estadual_emitente"]),
            inscricao_estadual_substituto_tributario=None
            if data.get("inscricao_estadual_substituto_tributario") is None
            else str(data["inscricao_estadual_substituto_tributario"]),
            inscricao_estadual_transportadora=None
            if data.get("inscricao_estadual_transportadora") is None
            else str(data["inscricao_estadual_transportadora"]),
            inscricao_municipal=None
            if data.get("inscricao_municipal") is None
            else float(data["inscricao_municipal"]),
            marca_volumes=None
            if data.get("marca_volumes") is None
            else str(data["marca_volumes"]),
            municipio_destinatario=None
            if data.get("municipio_destinatario") is None
            else str(data["municipio_destinatario"]),
            municipio_emitente=None
            if data.get("municipio_emitente") is None
            else str(data["municipio_emitente"]),
            municipio_transportadora=None
            if data.get("municipio_transportadora") is None
            else str(data["municipio_transportadora"]),
            natureza_operacao=None
            if data.get("natureza_operacao") is None
            else str(data["natureza_operacao"]),
            ncm_sh=None if data.get("ncm_sh") is None else str(data["ncm_sh"]),
            nome_destinatario=None
            if data.get("nome_destinatario") is None
            else str(data["nome_destinatario"]),
            numero_nota=None
            if data.get("numero_nota") is None
            else str(data["numero_nota"]),
            numero_volumes=None
            if data.get("numero_volumes") is None
            else str(data["numero_volumes"]),
            outras_despesas=None
            if data.get("outras_despesas") is None
            else float(data["outras_despesas"]),
            peso_bruto_kg=None
            if data.get("peso_bruto_kg") is None
            else float(data["peso_bruto_kg"]),
            peso_liquido_kg=None
            if data.get("peso_liquido_kg") is None
            else float(data["peso_liquido_kg"]),
            placa_veiculo=None
            if data.get("placa_veiculo") is None
            else str(data["placa_veiculo"]),
            protocolo_autorizacao=None
            if data.get("protocolo_autorizacao") is None
            else str(data["protocolo_autorizacao"]),
            quantidade=None
            if data.get("quantidade") is None
            else str(data["quantidade"]),
            quantidade_volumes=None
            if data.get("quantidade_volumes") is None
            else str(data["quantidade_volumes"]),
            razao_social_destinatario=None
            if data.get("razao_social_destinatario") is None
            else str(data["razao_social_destinatario"]),
            razao_social_emitente=None
            if data.get("razao_social_emitente") is None
            else str(data["razao_social_emitente"]),
            razao_social_transportadora=None
            if data.get("razao_social_transportadora") is None
            else str(data["razao_social_transportadora"]),
            serie=None if data.get("serie") is None else str(data["serie"]),
            telefone_destinatario=None
            if data.get("telefone_destinatario") is None
            else str(data["telefone_destinatario"]),
            telefone_emitente=None
            if data.get("telefone_emitente") is None
            else str(data["telefone_emitente"]),
            uf_destinatario=None
            if data.get("uf_destinatario") is None
            else str(data["uf_destinatario"]),
            uf_emitente=None
            if data.get("uf_emitente") is None
            else str(data["uf_emitente"]),
            uf_transportadora=None
            if data.get("uf_transportadora") is None
            else str(data["uf_transportadora"]),
            uf_veiculo=None
            if data.get("uf_veiculo") is None
            else str(data["uf_veiculo"]),
            unidade=None if data.get("unidade") is None else str(data["unidade"]),
            valor_fcp_st=None
            if data.get("valor_fcp_st") is None
            else float(data["valor_fcp_st"]),
            valor_frete=None
            if data.get("valor_frete") is None
            else float(data["valor_frete"]),
            valor_icms=None
            if data.get("valor_icms") is None
            else float(data["valor_icms"]),
            valor_icms_st=None
            if data.get("valor_icms_st") is None
            else float(data["valor_icms_st"]),
            valor_ipi=None
            if data.get("valor_ipi") is None
            else float(data["valor_ipi"]),
            valor_issqn=None
            if data.get("valor_issqn") is None
            else float(data["valor_issqn"]),
            valor_produtos=None
            if data.get("valor_produtos") is None
            else float(data["valor_produtos"]),
            valor_seguro=None
            if data.get("valor_seguro") is None
            else float(data["valor_seguro"]),
            valor_total=None
            if data.get("valor_total") is None
            else float(data["valor_total"]),
            valor_tributos=None
            if data.get("valor_tributos") is None
            else float(data["valor_tributos"]),
            valor_unitario=None
            if data.get("valor_unitario") is None
            else float(data["valor_unitario"]),
        )


CloudApiCliModelsUsPassportResponseFamilyName = str

CloudApiCliModelsUsPassportResponseGivenNames = str

CloudApiCliModelsUsPassportResponseDocumentId = str

CloudApiCliModelsUsPassportResponseExpirationDate = datetime.date

CloudApiCliModelsUsPassportResponseDateOfBirth = datetime.date

CloudApiCliModelsUsPassportResponseIssueDate = datetime.date

CloudApiCliModelsUsPassportResponseMrzCode = str

CloudApiCliModelsUsPassportResponsePortrait = str


@dataclass
class CloudApiCliModelsUsPassportResponse:
    family_name: typing.Optional[CloudApiCliModelsUsPassportResponseFamilyName] = field(
        default_factory=lambda: None
    )
    given_names: typing.Optional[CloudApiCliModelsUsPassportResponseGivenNames] = field(
        default_factory=lambda: None
    )
    document_id: typing.Optional[CloudApiCliModelsUsPassportResponseDocumentId] = field(
        default_factory=lambda: None
    )
    expiration_date: typing.Optional[
        CloudApiCliModelsUsPassportResponseExpirationDate
    ] = field(default_factory=lambda: None)
    date_of_birth: typing.Optional[CloudApiCliModelsUsPassportResponseDateOfBirth] = (
        field(default_factory=lambda: None)
    )
    issue_date: typing.Optional[CloudApiCliModelsUsPassportResponseIssueDate] = field(
        default_factory=lambda: None
    )
    mrz_code: typing.Optional[CloudApiCliModelsUsPassportResponseMrzCode] = field(
        default_factory=lambda: None
    )
    portrait: typing.Optional[CloudApiCliModelsUsPassportResponsePortrait] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.family_name is not None:
            data["family_name"] = self.family_name
        if self.given_names is not None:
            data["given_names"] = self.given_names
        if self.document_id is not None:
            data["document_id"] = self.document_id
        if self.expiration_date is not None:
            data["expiration_date"] = self.expiration_date.isoformat()
        if self.date_of_birth is not None:
            data["date_of_birth"] = self.date_of_birth.isoformat()
        if self.issue_date is not None:
            data["issue_date"] = self.issue_date.isoformat()
        if self.mrz_code is not None:
            data["mrz_code"] = self.mrz_code
        if self.portrait is not None:
            data["portrait"] = self.portrait
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsUsPassportResponse":
        return cls(
            family_name=None
            if data.get("family_name") is None
            else str(data["family_name"]),
            given_names=None
            if data.get("given_names") is None
            else str(data["given_names"]),
            document_id=None
            if data.get("document_id") is None
            else str(data["document_id"]),
            expiration_date=None
            if data.get("expiration_date") is None
            else datetime.date.fromisoformat(data["expiration_date"]),
            date_of_birth=None
            if data.get("date_of_birth") is None
            else datetime.date.fromisoformat(data["date_of_birth"]),
            issue_date=None
            if data.get("issue_date") is None
            else datetime.date.fromisoformat(data["issue_date"]),
            mrz_code=None if data.get("mrz_code") is None else str(data["mrz_code"]),
            portrait=None if data.get("portrait") is None else str(data["portrait"]),
        )


CloudApiCliModelsInvoiceResponseAmountPaidSinceLastInvoice = float

CloudApiCliModelsInvoiceResponseCarrier = str

CloudApiCliModelsInvoiceResponseCurrency = str

CloudApiCliModelsInvoiceResponseCurrencyExchangeRate = float

CloudApiCliModelsInvoiceResponseDeliveryDate = datetime.datetime

CloudApiCliModelsInvoiceResponseDueDate = datetime.datetime

CloudApiCliModelsInvoiceResponseFreightAmount = float

CloudApiCliModelsInvoiceResponseInvoiceDate = datetime.datetime

CloudApiCliModelsInvoiceResponseInvoiceId = str

CloudApiCliModelsInvoiceResponseNetAmount = float

CloudApiCliModelsInvoiceResponsePaymentTerms = str

CloudApiCliModelsInvoiceResponsePurchaseOrder = str

CloudApiCliModelsInvoiceResponseReceiverAddress = str

CloudApiCliModelsInvoiceResponseReceiverEmail = str

CloudApiCliModelsInvoiceResponseReceiverName = str

CloudApiCliModelsInvoiceResponseReceiverPhone = str

CloudApiCliModelsInvoiceResponseReceiverTaxId = str

CloudApiCliModelsInvoiceResponseReceiverWebsite = str

CloudApiCliModelsInvoiceResponseRemitToAddress = str

CloudApiCliModelsInvoiceResponseRemitToName = str

CloudApiCliModelsInvoiceResponseShipFromAddress = str

CloudApiCliModelsInvoiceResponseShipFromName = str

CloudApiCliModelsInvoiceResponseShipToAddress = str

CloudApiCliModelsInvoiceResponseShipToName = str

CloudApiCliModelsInvoiceResponseSupplierAddress = str

CloudApiCliModelsInvoiceResponseSupplierEmail = str

CloudApiCliModelsInvoiceResponseSupplierIban = str

CloudApiCliModelsInvoiceResponseSupplierName = str

CloudApiCliModelsInvoiceResponseSupplierPaymentRef = str

CloudApiCliModelsInvoiceResponseSupplierPhone = str

CloudApiCliModelsInvoiceResponseSupplierRegistration = str

CloudApiCliModelsInvoiceResponseSupplierTaxId = str

CloudApiCliModelsInvoiceResponseSupplierWebsite = str

CloudApiCliModelsInvoiceResponseTotalAmount = float

CloudApiCliModelsInvoiceResponseTotalTaxAmount = float


@dataclass
class CloudApiCliModelsInvoiceResponse:
    amount_paid_since_last_invoice: typing.Optional[
        CloudApiCliModelsInvoiceResponseAmountPaidSinceLastInvoice
    ] = field(default_factory=lambda: None)
    carrier: typing.Optional[CloudApiCliModelsInvoiceResponseCarrier] = field(
        default_factory=lambda: None
    )
    currency: typing.Optional[CloudApiCliModelsInvoiceResponseCurrency] = field(
        default_factory=lambda: None
    )
    currency_exchange_rate: typing.Optional[
        CloudApiCliModelsInvoiceResponseCurrencyExchangeRate
    ] = field(default_factory=lambda: None)
    delivery_date: typing.Optional[CloudApiCliModelsInvoiceResponseDeliveryDate] = (
        field(default_factory=lambda: None)
    )
    due_date: typing.Optional[CloudApiCliModelsInvoiceResponseDueDate] = field(
        default_factory=lambda: None
    )
    freight_amount: typing.Optional[CloudApiCliModelsInvoiceResponseFreightAmount] = (
        field(default_factory=lambda: None)
    )
    invoice_date: typing.Optional[CloudApiCliModelsInvoiceResponseInvoiceDate] = field(
        default_factory=lambda: None
    )
    invoice_id: typing.Optional[CloudApiCliModelsInvoiceResponseInvoiceId] = field(
        default_factory=lambda: None
    )
    net_amount: typing.Optional[CloudApiCliModelsInvoiceResponseNetAmount] = field(
        default_factory=lambda: None
    )
    payment_terms: typing.Optional[CloudApiCliModelsInvoiceResponsePaymentTerms] = (
        field(default_factory=lambda: None)
    )
    purchase_order: typing.Optional[CloudApiCliModelsInvoiceResponsePurchaseOrder] = (
        field(default_factory=lambda: None)
    )
    receiver_address: typing.Optional[
        CloudApiCliModelsInvoiceResponseReceiverAddress
    ] = field(default_factory=lambda: None)
    receiver_email: typing.Optional[CloudApiCliModelsInvoiceResponseReceiverEmail] = (
        field(default_factory=lambda: None)
    )
    receiver_name: typing.Optional[CloudApiCliModelsInvoiceResponseReceiverName] = (
        field(default_factory=lambda: None)
    )
    receiver_phone: typing.Optional[CloudApiCliModelsInvoiceResponseReceiverPhone] = (
        field(default_factory=lambda: None)
    )
    receiver_tax_id: typing.Optional[CloudApiCliModelsInvoiceResponseReceiverTaxId] = (
        field(default_factory=lambda: None)
    )
    receiver_website: typing.Optional[
        CloudApiCliModelsInvoiceResponseReceiverWebsite
    ] = field(default_factory=lambda: None)
    remit_to_address: typing.Optional[
        CloudApiCliModelsInvoiceResponseRemitToAddress
    ] = field(default_factory=lambda: None)
    remit_to_name: typing.Optional[CloudApiCliModelsInvoiceResponseRemitToName] = field(
        default_factory=lambda: None
    )
    ship_from_address: typing.Optional[
        CloudApiCliModelsInvoiceResponseShipFromAddress
    ] = field(default_factory=lambda: None)
    ship_from_name: typing.Optional[CloudApiCliModelsInvoiceResponseShipFromName] = (
        field(default_factory=lambda: None)
    )
    ship_to_address: typing.Optional[CloudApiCliModelsInvoiceResponseShipToAddress] = (
        field(default_factory=lambda: None)
    )
    ship_to_name: typing.Optional[CloudApiCliModelsInvoiceResponseShipToName] = field(
        default_factory=lambda: None
    )
    supplier_address: typing.Optional[
        CloudApiCliModelsInvoiceResponseSupplierAddress
    ] = field(default_factory=lambda: None)
    supplier_email: typing.Optional[CloudApiCliModelsInvoiceResponseSupplierEmail] = (
        field(default_factory=lambda: None)
    )
    supplier_iban: typing.Optional[CloudApiCliModelsInvoiceResponseSupplierIban] = (
        field(default_factory=lambda: None)
    )
    supplier_name: typing.Optional[CloudApiCliModelsInvoiceResponseSupplierName] = (
        field(default_factory=lambda: None)
    )
    supplier_payment_ref: typing.Optional[
        CloudApiCliModelsInvoiceResponseSupplierPaymentRef
    ] = field(default_factory=lambda: None)
    supplier_phone: typing.Optional[CloudApiCliModelsInvoiceResponseSupplierPhone] = (
        field(default_factory=lambda: None)
    )
    supplier_registration: typing.Optional[
        CloudApiCliModelsInvoiceResponseSupplierRegistration
    ] = field(default_factory=lambda: None)
    supplier_tax_id: typing.Optional[CloudApiCliModelsInvoiceResponseSupplierTaxId] = (
        field(default_factory=lambda: None)
    )
    supplier_website: typing.Optional[
        CloudApiCliModelsInvoiceResponseSupplierWebsite
    ] = field(default_factory=lambda: None)
    total_amount: typing.Optional[CloudApiCliModelsInvoiceResponseTotalAmount] = field(
        default_factory=lambda: None
    )
    total_tax_amount: typing.Optional[
        CloudApiCliModelsInvoiceResponseTotalTaxAmount
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.amount_paid_since_last_invoice is not None:
            data["amount_paid_since_last_invoice"] = self.amount_paid_since_last_invoice
        if self.carrier is not None:
            data["carrier"] = self.carrier
        if self.currency is not None:
            data["currency"] = self.currency
        if self.currency_exchange_rate is not None:
            data["currency_exchange_rate"] = self.currency_exchange_rate
        if self.delivery_date is not None:
            data["delivery_date"] = self.delivery_date.isoformat()
        if self.due_date is not None:
            data["due_date"] = self.due_date.isoformat()
        if self.freight_amount is not None:
            data["freight_amount"] = self.freight_amount
        if self.invoice_date is not None:
            data["invoice_date"] = self.invoice_date.isoformat()
        if self.invoice_id is not None:
            data["invoice_id"] = self.invoice_id
        if self.net_amount is not None:
            data["net_amount"] = self.net_amount
        if self.payment_terms is not None:
            data["payment_terms"] = self.payment_terms
        if self.purchase_order is not None:
            data["purchase_order"] = self.purchase_order
        if self.receiver_address is not None:
            data["receiver_address"] = self.receiver_address
        if self.receiver_email is not None:
            data["receiver_email"] = self.receiver_email
        if self.receiver_name is not None:
            data["receiver_name"] = self.receiver_name
        if self.receiver_phone is not None:
            data["receiver_phone"] = self.receiver_phone
        if self.receiver_tax_id is not None:
            data["receiver_tax_id"] = self.receiver_tax_id
        if self.receiver_website is not None:
            data["receiver_website"] = self.receiver_website
        if self.remit_to_address is not None:
            data["remit_to_address"] = self.remit_to_address
        if self.remit_to_name is not None:
            data["remit_to_name"] = self.remit_to_name
        if self.ship_from_address is not None:
            data["ship_from_address"] = self.ship_from_address
        if self.ship_from_name is not None:
            data["ship_from_name"] = self.ship_from_name
        if self.ship_to_address is not None:
            data["ship_to_address"] = self.ship_to_address
        if self.ship_to_name is not None:
            data["ship_to_name"] = self.ship_to_name
        if self.supplier_address is not None:
            data["supplier_address"] = self.supplier_address
        if self.supplier_email is not None:
            data["supplier_email"] = self.supplier_email
        if self.supplier_iban is not None:
            data["supplier_iban"] = self.supplier_iban
        if self.supplier_name is not None:
            data["supplier_name"] = self.supplier_name
        if self.supplier_payment_ref is not None:
            data["supplier_payment_ref"] = self.supplier_payment_ref
        if self.supplier_phone is not None:
            data["supplier_phone"] = self.supplier_phone
        if self.supplier_registration is not None:
            data["supplier_registration"] = self.supplier_registration
        if self.supplier_tax_id is not None:
            data["supplier_tax_id"] = self.supplier_tax_id
        if self.supplier_website is not None:
            data["supplier_website"] = self.supplier_website
        if self.total_amount is not None:
            data["total_amount"] = self.total_amount
        if self.total_tax_amount is not None:
            data["total_tax_amount"] = self.total_tax_amount
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliModelsInvoiceResponse":
        return cls(
            amount_paid_since_last_invoice=None
            if data.get("amount_paid_since_last_invoice") is None
            else float(data["amount_paid_since_last_invoice"]),
            carrier=None if data.get("carrier") is None else str(data["carrier"]),
            currency=None if data.get("currency") is None else str(data["currency"]),
            currency_exchange_rate=None
            if data.get("currency_exchange_rate") is None
            else float(data["currency_exchange_rate"]),
            delivery_date=None
            if data.get("delivery_date") is None
            else datetime.datetime.fromisoformat(data["delivery_date"]),
            due_date=None
            if data.get("due_date") is None
            else datetime.datetime.fromisoformat(data["due_date"]),
            freight_amount=None
            if data.get("freight_amount") is None
            else float(data["freight_amount"]),
            invoice_date=None
            if data.get("invoice_date") is None
            else datetime.datetime.fromisoformat(data["invoice_date"]),
            invoice_id=None
            if data.get("invoice_id") is None
            else str(data["invoice_id"]),
            net_amount=None
            if data.get("net_amount") is None
            else float(data["net_amount"]),
            payment_terms=None
            if data.get("payment_terms") is None
            else str(data["payment_terms"]),
            purchase_order=None
            if data.get("purchase_order") is None
            else str(data["purchase_order"]),
            receiver_address=None
            if data.get("receiver_address") is None
            else str(data["receiver_address"]),
            receiver_email=None
            if data.get("receiver_email") is None
            else str(data["receiver_email"]),
            receiver_name=None
            if data.get("receiver_name") is None
            else str(data["receiver_name"]),
            receiver_phone=None
            if data.get("receiver_phone") is None
            else str(data["receiver_phone"]),
            receiver_tax_id=None
            if data.get("receiver_tax_id") is None
            else str(data["receiver_tax_id"]),
            receiver_website=None
            if data.get("receiver_website") is None
            else str(data["receiver_website"]),
            remit_to_address=None
            if data.get("remit_to_address") is None
            else str(data["remit_to_address"]),
            remit_to_name=None
            if data.get("remit_to_name") is None
            else str(data["remit_to_name"]),
            ship_from_address=None
            if data.get("ship_from_address") is None
            else str(data["ship_from_address"]),
            ship_from_name=None
            if data.get("ship_from_name") is None
            else str(data["ship_from_name"]),
            ship_to_address=None
            if data.get("ship_to_address") is None
            else str(data["ship_to_address"]),
            ship_to_name=None
            if data.get("ship_to_name") is None
            else str(data["ship_to_name"]),
            supplier_address=None
            if data.get("supplier_address") is None
            else str(data["supplier_address"]),
            supplier_email=None
            if data.get("supplier_email") is None
            else str(data["supplier_email"]),
            supplier_iban=None
            if data.get("supplier_iban") is None
            else str(data["supplier_iban"]),
            supplier_name=None
            if data.get("supplier_name") is None
            else str(data["supplier_name"]),
            supplier_payment_ref=None
            if data.get("supplier_payment_ref") is None
            else str(data["supplier_payment_ref"]),
            supplier_phone=None
            if data.get("supplier_phone") is None
            else str(data["supplier_phone"]),
            supplier_registration=None
            if data.get("supplier_registration") is None
            else str(data["supplier_registration"]),
            supplier_tax_id=None
            if data.get("supplier_tax_id") is None
            else str(data["supplier_tax_id"]),
            supplier_website=None
            if data.get("supplier_website") is None
            else str(data["supplier_website"]),
            total_amount=None
            if data.get("total_amount") is None
            else float(data["total_amount"]),
            total_tax_amount=None
            if data.get("total_tax_amount") is None
            else float(data["total_tax_amount"]),
        )


CloudApiCliUserGetResponse = CommonUser

CloudApiCliAgentsPostResponseBody0Status = typing.Literal["finished"]

CloudApiCliAgentsPostResponseBody0StatusValues: typing.List[
    CloudApiCliAgentsPostResponseBody0Status
] = ["finished"]

CloudApiCliAgentsPostResponseBody0Data = typing.Any


@dataclass
class CloudApiCliAgentsPostResponseBody0:
    status: typing.Optional[CloudApiCliAgentsPostResponseBody0Status] = field(
        default_factory=lambda: None
    )
    data: typing.Optional[CloudApiCliAgentsPostResponseBody0Data] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.status is not None:
            data["status"] = self.status
        if self.data is not None:
            data["data"] = self.data
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostResponseBody0":
        return cls(
            status=None if data.get("status") is None else data["status"],
            data=None if data.get("data") is None else data["data"],
        )


CloudApiCliAgentsPostResponseBody1Status = typing.Literal["function-call"]

CloudApiCliAgentsPostResponseBody1StatusValues: typing.List[
    CloudApiCliAgentsPostResponseBody1Status
] = ["function-call"]

CloudApiCliAgentsPostResponseBody1FunctionName = str


@dataclass
class CloudApiCliAgentsPostResponseBody1Arguments:
    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostResponseBody1Arguments":
        return cls()


CloudApiCliAgentsPostResponseBody1SessionId = str


@dataclass
class CloudApiCliAgentsPostResponseBody1:
    status: typing.Optional[CloudApiCliAgentsPostResponseBody1Status] = field(
        default_factory=lambda: None
    )
    function_name: typing.Optional[CloudApiCliAgentsPostResponseBody1FunctionName] = (
        field(default_factory=lambda: None)
    )
    arguments: typing.Optional[CloudApiCliAgentsPostResponseBody1Arguments] = field(
        default_factory=lambda: None
    )
    session_id: typing.Optional[CloudApiCliAgentsPostResponseBody1SessionId] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.status is not None:
            data["status"] = self.status
        if self.function_name is not None:
            data["functionName"] = self.function_name
        if self.arguments is not None:
            data["arguments"] = self.arguments.to_dict()
        if self.session_id is not None:
            data["sessionId"] = self.session_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostResponseBody1":
        return cls(
            status=None if data.get("status") is None else data["status"],
            function_name=None
            if data.get("functionName") is None
            else str(data["functionName"]),
            arguments=None
            if data.get("arguments") is None
            else CloudApiCliAgentsPostResponseBody1Arguments.from_dict(
                data["arguments"]
            ),
            session_id=None
            if data.get("sessionId") is None
            else str(data["sessionId"]),
        )


CloudApiCliAgentsPostResponseBody = typing.Union[
    CloudApiCliAgentsPostResponseBody0, CloudApiCliAgentsPostResponseBody1
]


def cloud_api_cli_agents_post_response_body_from_dict(
    data: typing.Any,
) -> "CloudApiCliAgentsPostResponseBody":
    if isinstance(data, dict) and (data.get("status", None) == "finished"):
        return CloudApiCliAgentsPostResponseBody0.from_dict(data)
    if isinstance(data, dict) and (data.get("status", None) == "function-call"):
        return CloudApiCliAgentsPostResponseBody1.from_dict(data)
    raise ValueError(
        f"Could not parse CloudApiCliAgentsPostResponseBody from dict: {data}"
    )


CloudApiCliAgentsPostRequestBodyStartType = typing.Literal["start"]

CloudApiCliAgentsPostRequestBodyStartTypeValues: typing.List[
    CloudApiCliAgentsPostRequestBodyStartType
] = ["start"]

CloudApiCliAiV2PromptPostRequestMessagesItemRole = typing.Union[
    typing.Literal["system"], typing.Literal["user"], typing.Literal["assistant"]
]

CloudApiCliAiV2PromptPostRequestMessagesItemRoleValues: typing.List[
    CloudApiCliAiV2PromptPostRequestMessagesItemRole
] = ["system", "user", "assistant"]

CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextType = typing.Literal["text"]

CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextTypeValues: typing.List[
    CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextType
] = ["text"]

CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextText = str


@dataclass
class CloudApiCliAiV2PromptPostRequestMessagesItemContentItemText:
    type: CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextType
    text: CloudApiCliAiV2PromptPostRequestMessagesItemContentItemTextText

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["text"] = self.text
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestMessagesItemContentItemText":
        return cls(
            type=data["type"],
            text=str(data["text"]),
        )


CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageType = typing.Literal[
    "image_url"
]

CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageTypeValues: typing.List[
    CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageType
] = ["image_url"]

CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrlUrl = str


@dataclass
class CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrl:
    url: CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrlUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["url"] = self.url
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrl":
        return cls(
            url=str(data["url"]),
        )


@dataclass
class CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImage:
    type: CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageType
    image_url: CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["image_url"] = self.image_url.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImage":
        return cls(
            type=data["type"],
            image_url=CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImageImageUrl.from_dict(
                data["image_url"]
            ),
        )


CloudApiCliAiV2PromptPostRequestMessagesItemContentItem = typing.Union[
    CloudApiCliAiV2PromptPostRequestMessagesItemContentItemText,
    CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImage,
]


def cloud_api_cli_ai_v2_prompt_post_request_messages_item_content_item_from_dict(
    data: typing.Any,
) -> "CloudApiCliAiV2PromptPostRequestMessagesItemContentItem":
    if isinstance(data, dict) and (data.get("type", None) == "text"):
        return CloudApiCliAiV2PromptPostRequestMessagesItemContentItemText.from_dict(
            data
        )
    if isinstance(data, dict) and (data.get("type", None) == "image_url"):
        return CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImage.from_dict(
            data
        )
    raise ValueError(
        f"Could not parse CloudApiCliAiV2PromptPostRequestMessagesItemContentItem from dict: {data}"
    )


CloudApiCliAiV2PromptPostRequestMessagesItemContent = typing.List[
    CloudApiCliAiV2PromptPostRequestMessagesItemContentItem
]


@dataclass
class CloudApiCliAiV2PromptPostRequestMessagesItem:
    role: CloudApiCliAiV2PromptPostRequestMessagesItemRole
    content: CloudApiCliAiV2PromptPostRequestMessagesItemContent

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["role"] = self.role
        data["content"] = [item.to_dict() for item in self.content]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestMessagesItem":
        return cls(
            role=data["role"],
            content=[
                (
                    CloudApiCliAiV2PromptPostRequestMessagesItemContentItemText.from_dict(
                        item
                    )
                    if isinstance(item, dict) and (item.get("type", None) == "text")
                    else CloudApiCliAiV2PromptPostRequestMessagesItemContentItemImage.from_dict(
                        item
                    )
                )
                for item in data["content"]
            ],
        )


CloudApiCliAiV2PromptPostRequestMessages = typing.List[
    CloudApiCliAiV2PromptPostRequestMessagesItem
]

CloudApiCliAgentsPostRequestBodyStartPrompt = CloudApiCliAiV2PromptPostRequestMessages

CloudApiCliAgentsPostRequestBodyStartToolsItemFunctionName = str

CloudApiCliAgentsPostRequestBodyStartToolsItemDescription = str

CloudApiCliAgentsPostRequestBodyStartToolsItemParameters = typing.Dict[str, typing.Any]


@dataclass
class CloudApiCliAgentsPostRequestBodyStartToolsItemReturnType:
    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostRequestBodyStartToolsItemReturnType":
        return cls()


@dataclass
class CloudApiCliAgentsPostRequestBodyStartToolsItem:
    function_name: CloudApiCliAgentsPostRequestBodyStartToolsItemFunctionName
    description: CloudApiCliAgentsPostRequestBodyStartToolsItemDescription
    parameters: CloudApiCliAgentsPostRequestBodyStartToolsItemParameters
    return_type: typing.Optional[
        CloudApiCliAgentsPostRequestBodyStartToolsItemReturnType
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["functionName"] = self.function_name
        data["description"] = self.description
        data["parameters"] = self.parameters
        if self.return_type is not None:
            data["returnType"] = self.return_type.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostRequestBodyStartToolsItem":
        return cls(
            function_name=str(data["functionName"]),
            description=str(data["description"]),
            parameters=dict(**data["parameters"]),
            return_type=None
            if data.get("returnType") is None
            else CloudApiCliAgentsPostRequestBodyStartToolsItemReturnType.from_dict(
                data["returnType"]
            ),
        )


CloudApiCliAgentsPostRequestBodyStartTools = typing.List[
    CloudApiCliAgentsPostRequestBodyStartToolsItem
]

CloudApiCliAgentsPostRequestBodyStartMaxSteps = int


@dataclass
class CloudApiCliAgentsPostRequestBodyStart:
    prompt: CloudApiCliAgentsPostRequestBodyStartPrompt
    type: typing.Optional[CloudApiCliAgentsPostRequestBodyStartType] = field(
        default_factory=lambda: None
    )
    tools: typing.Optional[CloudApiCliAgentsPostRequestBodyStartTools] = field(
        default_factory=lambda: None
    )
    max_steps: typing.Optional[CloudApiCliAgentsPostRequestBodyStartMaxSteps] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["prompt"] = [item.to_dict() for item in self.prompt]
        if self.type is not None:
            data["type"] = self.type
        if self.tools is not None:
            data["tools"] = [item.to_dict() for item in self.tools]
        if self.max_steps is not None:
            data["maxSteps"] = self.max_steps
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostRequestBodyStart":
        return cls(
            prompt=[
                CloudApiCliAiV2PromptPostRequestMessagesItem.from_dict(item)
                for item in data["prompt"]
            ],
            type=None if data.get("type") is None else data["type"],
            tools=None
            if data.get("tools") is None
            else [
                CloudApiCliAgentsPostRequestBodyStartToolsItem.from_dict(item)
                for item in data["tools"]
            ],
            max_steps=None if data.get("maxSteps") is None else int(data["maxSteps"]),
        )


CloudApiCliAgentsPostRequestBodyResponseType = typing.Literal["response"]

CloudApiCliAgentsPostRequestBodyResponseTypeValues: typing.List[
    CloudApiCliAgentsPostRequestBodyResponseType
] = ["response"]

CloudApiCliAgentsPostRequestBodyResponseSessionId = str

CloudApiCliAgentsPostRequestBodyResponseValue = typing.Any

CloudApiCliAgentsPostRequestBodyResponseEncoding = typing.Union[
    typing.Literal["explicit"], typing.Literal["image/base64"]
]

CloudApiCliAgentsPostRequestBodyResponseEncodingValues: typing.List[
    CloudApiCliAgentsPostRequestBodyResponseEncoding
] = ["explicit", "image/base64"]


@dataclass
class CloudApiCliAgentsPostRequestBodyResponse:
    type: typing.Optional[CloudApiCliAgentsPostRequestBodyResponseType] = field(
        default_factory=lambda: None
    )
    session_id: typing.Optional[CloudApiCliAgentsPostRequestBodyResponseSessionId] = (
        field(default_factory=lambda: None)
    )
    value: typing.Optional[CloudApiCliAgentsPostRequestBodyResponseValue] = field(
        default_factory=lambda: None
    )
    encoding: typing.Optional[CloudApiCliAgentsPostRequestBodyResponseEncoding] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.type is not None:
            data["type"] = self.type
        if self.session_id is not None:
            data["sessionId"] = self.session_id
        if self.value is not None:
            data["value"] = self.value
        if self.encoding is not None:
            data["encoding"] = self.encoding
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAgentsPostRequestBodyResponse":
        return cls(
            type=None if data.get("type") is None else data["type"],
            session_id=None
            if data.get("sessionId") is None
            else str(data["sessionId"]),
            value=None if data.get("value") is None else data["value"],
            encoding=None if data.get("encoding") is None else data["encoding"],
        )


CloudApiCliAgentsPostRequestBody = typing.Union[
    CloudApiCliAgentsPostRequestBodyStart, CloudApiCliAgentsPostRequestBodyResponse
]


def cloud_api_cli_agents_post_request_body_from_dict(
    data: typing.Any,
) -> "CloudApiCliAgentsPostRequestBody":
    if isinstance(data, dict) and (data.get("type", None) == "start"):
        return CloudApiCliAgentsPostRequestBodyStart.from_dict(data)
    if (
        isinstance(data, dict)
        and (data.get("type", None) == "response")
        and (
            data.get("encoding", None) == "explicit"
            or data.get("encoding", None) == "image/base64"
        )
    ):
        return CloudApiCliAgentsPostRequestBodyResponse.from_dict(data)
    raise ValueError(
        f"Could not parse CloudApiCliAgentsPostRequestBody from dict: {data}"
    )


CloudApiCliRoleUpdateRequestDescription = CommonRoleDescription


@dataclass
class CloudApiCliRoleUpdateRequest:
    description: CloudApiCliRoleUpdateRequestDescription

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["description"] = self.description
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliRoleUpdateRequest":
        return cls(
            description=str(data["description"]),
        )


CloudApiCliRoleUpdateResponse = CommonRole

CloudApiCliRoleListQueryOffset = int

CloudApiCliRoleListQueryLimit = int


@dataclass
class CloudApiCliRoleListQuery:
    offset: typing.Optional[CloudApiCliRoleListQueryOffset] = field(
        default_factory=lambda: 0
    )
    limit: typing.Optional[CloudApiCliRoleListQueryLimit] = field(
        default_factory=lambda: 10
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.offset is not None:
            data["offset"] = self.offset
        if self.limit is not None:
            data["limit"] = self.limit
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliRoleListQuery":
        return cls(
            offset=None if data.get("offset") is None else int(data["offset"]),
            limit=data.get("limit", 10),
        )


CloudApiCliRoleListResponseItem = CommonRole

CloudApiCliRoleListResponse = typing.List[CloudApiCliRoleListResponseItem]

CloudApiCliRoleCreateRequestName = CommonRoleName

CloudApiCliRoleCreateRequestDescription = CommonRoleDescription


@dataclass
class CloudApiCliRoleCreateRequest:
    name: CloudApiCliRoleCreateRequestName
    description: typing.Optional[CloudApiCliRoleCreateRequestDescription] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        if self.description is not None:
            data["description"] = self.description
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliRoleCreateRequest":
        return cls(
            name=str(data["name"]),
            description=None
            if data.get("description") is None
            else str(data["description"]),
        )


CloudApiCliRoleCreateResponse = CommonRole

CloudApiConsoleWorkflowUpdateTaskRequestStatus = typing.Union[
    typing.Literal["pending"], typing.Literal["locked"], typing.Literal["completed"]
]

CloudApiConsoleWorkflowUpdateTaskRequestStatusValues: typing.List[
    CloudApiConsoleWorkflowUpdateTaskRequestStatus
] = ["pending", "locked", "completed"]

CloudApiConsoleWorkflowUpdateTaskRequestCompletedAt = datetime.datetime

CloudApiConsoleWorkflowUpdateTaskRequestCompletedByExecutionId = str

CloudApiConsoleWorkflowUpdateTaskRequestCompletedByStageId = str


@dataclass
class CloudApiConsoleWorkflowUpdateTaskRequestCompleted:
    at: CloudApiConsoleWorkflowUpdateTaskRequestCompletedAt
    by_execution_id: typing.Optional[
        CloudApiConsoleWorkflowUpdateTaskRequestCompletedByExecutionId
    ] = field(default_factory=lambda: None)
    by_stage_id: typing.Optional[
        CloudApiConsoleWorkflowUpdateTaskRequestCompletedByStageId
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["at"] = self.at.isoformat()
        if self.by_execution_id is not None:
            data["byExecutionId"] = self.by_execution_id
        if self.by_stage_id is not None:
            data["byStageId"] = self.by_stage_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiConsoleWorkflowUpdateTaskRequestCompleted":
        return cls(
            at=datetime.datetime.fromisoformat(data["at"]),
            by_execution_id=None
            if data.get("byExecutionId") is None
            else str(data["byExecutionId"]),
            by_stage_id=None
            if data.get("byStageId") is None
            else str(data["byStageId"]),
        )


CloudApiConsoleWorkflowUpdateTaskRequestLockedAt = datetime.datetime

CloudApiConsoleWorkflowUpdateTaskRequestLockedByExecutionId = str

CloudApiConsoleWorkflowUpdateTaskRequestLockedByStageId = str


@dataclass
class CloudApiConsoleWorkflowUpdateTaskRequestLocked:
    at: CloudApiConsoleWorkflowUpdateTaskRequestLockedAt
    by_execution_id: typing.Optional[
        CloudApiConsoleWorkflowUpdateTaskRequestLockedByExecutionId
    ] = field(default_factory=lambda: None)
    by_stage_id: typing.Optional[
        CloudApiConsoleWorkflowUpdateTaskRequestLockedByStageId
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["at"] = self.at.isoformat()
        if self.by_execution_id is not None:
            data["byExecutionId"] = self.by_execution_id
        if self.by_stage_id is not None:
            data["byStageId"] = self.by_stage_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiConsoleWorkflowUpdateTaskRequestLocked":
        return cls(
            at=datetime.datetime.fromisoformat(data["at"]),
            by_execution_id=None
            if data.get("byExecutionId") is None
            else str(data["byExecutionId"]),
            by_stage_id=None
            if data.get("byStageId") is None
            else str(data["byStageId"]),
        )


@dataclass
class CloudApiConsoleWorkflowUpdateTaskRequest:
    status: typing.Optional[CloudApiConsoleWorkflowUpdateTaskRequestStatus] = field(
        default_factory=lambda: None
    )
    completed: typing.Optional[CloudApiConsoleWorkflowUpdateTaskRequestCompleted] = (
        field(default_factory=lambda: None)
    )
    locked: typing.Optional[CloudApiConsoleWorkflowUpdateTaskRequestLocked] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.status is not None:
            data["status"] = self.status
        if self.completed is not None:
            data["completed"] = self.completed.to_dict()
        if self.locked is not None:
            data["locked"] = self.locked.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiConsoleWorkflowUpdateTaskRequest":
        return cls(
            status=None if data.get("status") is None else data["status"],
            completed=None
            if data.get("completed") is None
            else CloudApiConsoleWorkflowUpdateTaskRequestCompleted.from_dict(
                data["completed"]
            ),
            locked=None
            if data.get("locked") is None
            else CloudApiConsoleWorkflowUpdateTaskRequestLocked.from_dict(
                data["locked"]
            ),
        )


CloudApiCliTasksUpdateTaskRequest = CloudApiConsoleWorkflowUpdateTaskRequest

CloudApiCliAiV2AbortRequestConversationId = str


@dataclass
class CloudApiCliAiV2AbortRequest:
    conversation_id: CloudApiCliAiV2AbortRequestConversationId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["conversationId"] = self.conversation_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2AbortRequest":
        return cls(
            conversation_id=str(data["conversationId"]),
        )


CloudApiCliAiV2StreamRequestConversationId = str

CloudApiCliAiV2StreamRequestTunnelSessionPath = str

CloudApiCliAiV2StreamRequestSecretKey = str

CloudApiCliAiV2StreamRequestHumanApproval = str

CloudApiCliAiV2StreamRequestToolCallsApprovalApprovedItem = str

CloudApiCliAiV2StreamRequestToolCallsApprovalApproved = typing.List[
    CloudApiCliAiV2StreamRequestToolCallsApprovalApprovedItem
]

CloudApiCliAiV2StreamRequestToolCallsApprovalRejectedItem = str

CloudApiCliAiV2StreamRequestToolCallsApprovalRejected = typing.List[
    CloudApiCliAiV2StreamRequestToolCallsApprovalRejectedItem
]


@dataclass
class CloudApiCliAiV2StreamRequestToolCallsApproval:
    approved: CloudApiCliAiV2StreamRequestToolCallsApprovalApproved
    rejected: CloudApiCliAiV2StreamRequestToolCallsApprovalRejected

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["approved"] = self.approved
        data["rejected"] = self.rejected
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2StreamRequestToolCallsApproval":
        return cls(
            approved=[str(item) for item in data["approved"]],
            rejected=[str(item) for item in data["rejected"]],
        )


CloudApiCliAiV2StreamRequestEmail = str

CloudApiCliAiV2StreamRequestStatus = typing.Union[
    typing.Literal["pending"], typing.Literal["active"], typing.Literal["invited"]
]

CloudApiCliAiV2StreamRequestStatusValues: typing.List[
    CloudApiCliAiV2StreamRequestStatus
] = ["pending", "active", "invited"]

CloudApiCliAiV2StreamRequestContentItemAssistantTextInputType = typing.Literal["text"]

CloudApiCliAiV2StreamRequestContentItemAssistantTextInputTypeValues: typing.List[
    CloudApiCliAiV2StreamRequestContentItemAssistantTextInputType
] = ["text"]

CloudApiCliAiV2StreamRequestContentItemAssistantTextInputText = str


@dataclass
class CloudApiCliAiV2StreamRequestContentItemAssistantTextInput:
    type: CloudApiCliAiV2StreamRequestContentItemAssistantTextInputType
    text: CloudApiCliAiV2StreamRequestContentItemAssistantTextInputText

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["text"] = self.text
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2StreamRequestContentItemAssistantTextInput":
        return cls(
            type=data["type"],
            text=str(data["text"]),
        )


CloudApiCliAiV2StreamRequestContentItemAssistantFileInputType = typing.Literal["file"]

CloudApiCliAiV2StreamRequestContentItemAssistantFileInputTypeValues: typing.List[
    CloudApiCliAiV2StreamRequestContentItemAssistantFileInputType
] = ["file"]

CloudApiCliAiV2StreamRequestContentItemAssistantFileInputFileName = str

CloudApiCliAiV2StreamRequestContentItemAssistantFileInputFileContent = str


@dataclass
class CloudApiCliAiV2StreamRequestContentItemAssistantFileInput:
    type: CloudApiCliAiV2StreamRequestContentItemAssistantFileInputType
    file_name: CloudApiCliAiV2StreamRequestContentItemAssistantFileInputFileName
    file_content: CloudApiCliAiV2StreamRequestContentItemAssistantFileInputFileContent

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["fileName"] = self.file_name
        data["fileContent"] = self.file_content
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2StreamRequestContentItemAssistantFileInput":
        return cls(
            type=data["type"],
            file_name=str(data["fileName"]),
            file_content=str(data["fileContent"]),
        )


CloudApiCliAiV2StreamRequestContentItem = typing.Union[
    CloudApiCliAiV2StreamRequestContentItemAssistantTextInput,
    CloudApiCliAiV2StreamRequestContentItemAssistantFileInput,
]


def cloud_api_cli_ai_v2_stream_request_content_item_from_dict(
    data: typing.Any,
) -> "CloudApiCliAiV2StreamRequestContentItem":
    if isinstance(data, dict) and (data.get("type", None) == "text"):
        return CloudApiCliAiV2StreamRequestContentItemAssistantTextInput.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "file"):
        return CloudApiCliAiV2StreamRequestContentItemAssistantFileInput.from_dict(data)
    raise ValueError(
        f"Could not parse CloudApiCliAiV2StreamRequestContentItem from dict: {data}"
    )


CloudApiCliAiV2StreamRequestContent = typing.List[
    CloudApiCliAiV2StreamRequestContentItem
]

CloudApiCliAiV2StreamRequestContext = typing.Dict[str, typing.Any]

CloudApiConsoleBrowserToolsDefinitionName = str

CloudApiConsoleBrowserToolsDefinitionDescription = str

CloudApiConsoleBrowserToolsDefinitionPayloadSchema = typing.Dict[str, typing.Any]


@dataclass
class CloudApiConsoleBrowserToolsDefinition:
    name: CloudApiConsoleBrowserToolsDefinitionName
    description: CloudApiConsoleBrowserToolsDefinitionDescription
    payload_schema: CloudApiConsoleBrowserToolsDefinitionPayloadSchema

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["description"] = self.description
        data["payloadSchema"] = self.payload_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiConsoleBrowserToolsDefinition":
        return cls(
            name=str(data["name"]),
            description=str(data["description"]),
            payload_schema=dict(**data["payloadSchema"]),
        )


CloudApiCliAiV2StreamRequestBrowserToolsItem = CloudApiConsoleBrowserToolsDefinition

CloudApiCliAiV2StreamRequestBrowserTools = typing.List[
    CloudApiCliAiV2StreamRequestBrowserToolsItem
]

CloudApiConsoleBrowserToolsResponseToolCallId = str

CloudApiConsoleBrowserToolsResponseResponse = typing.Any


@dataclass
class CloudApiConsoleBrowserToolsResponse:
    tool_call_id: CloudApiConsoleBrowserToolsResponseToolCallId
    response: CloudApiConsoleBrowserToolsResponseResponse

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["toolCallId"] = self.tool_call_id
        data["response"] = self.response
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiConsoleBrowserToolsResponse":
        return cls(
            tool_call_id=str(data["toolCallId"]),
            response=data["response"],
        )


CloudApiCliAiV2StreamRequestBrowserToolResponsesItem = (
    CloudApiConsoleBrowserToolsResponse
)

CloudApiCliAiV2StreamRequestBrowserToolResponses = typing.List[
    CloudApiCliAiV2StreamRequestBrowserToolResponsesItem
]

CloudApiCliAiV2StreamRequestAutoApproveToolCalls = bool


@dataclass
class CloudApiCliAiV2StreamRequest:
    conversation_id: CloudApiCliAiV2StreamRequestConversationId
    content: CloudApiCliAiV2StreamRequestContent
    tunnel_session_path: typing.Optional[
        CloudApiCliAiV2StreamRequestTunnelSessionPath
    ] = field(default_factory=lambda: None)
    secret_key: typing.Optional[CloudApiCliAiV2StreamRequestSecretKey] = field(
        default_factory=lambda: None
    )
    human_approval: typing.Optional[CloudApiCliAiV2StreamRequestHumanApproval] = field(
        default_factory=lambda: None
    )
    tool_calls_approval: typing.Optional[
        CloudApiCliAiV2StreamRequestToolCallsApproval
    ] = field(default_factory=lambda: None)
    email: typing.Optional[CloudApiCliAiV2StreamRequestEmail] = field(
        default_factory=lambda: None
    )
    status: typing.Optional[CloudApiCliAiV2StreamRequestStatus] = field(
        default_factory=lambda: None
    )
    context: typing.Optional[CloudApiCliAiV2StreamRequestContext] = field(
        default_factory=lambda: None
    )
    browser_tools: typing.Optional[CloudApiCliAiV2StreamRequestBrowserTools] = field(
        default_factory=lambda: None
    )
    browser_tool_responses: typing.Optional[
        CloudApiCliAiV2StreamRequestBrowserToolResponses
    ] = field(default_factory=lambda: None)
    auto_approve_tool_calls: typing.Optional[
        CloudApiCliAiV2StreamRequestAutoApproveToolCalls
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["conversationId"] = self.conversation_id
        data["content"] = [item.to_dict() for item in self.content]
        if self.tunnel_session_path is not None:
            data["tunnelSessionPath"] = self.tunnel_session_path
        if self.secret_key is not None:
            data["secretKey"] = self.secret_key
        if self.human_approval is not None:
            data["humanApproval"] = self.human_approval
        if self.tool_calls_approval is not None:
            data["toolCallsApproval"] = self.tool_calls_approval.to_dict()
        if self.email is not None:
            data["email"] = self.email
        if self.status is not None:
            data["status"] = self.status
        if self.context is not None:
            data["context"] = self.context
        if self.browser_tools is not None:
            data["browserTools"] = [item.to_dict() for item in self.browser_tools]
        if self.browser_tool_responses is not None:
            data["browserToolResponses"] = [
                item.to_dict() for item in self.browser_tool_responses
            ]
        if self.auto_approve_tool_calls is not None:
            data["autoApproveToolCalls"] = self.auto_approve_tool_calls
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2StreamRequest":
        return cls(
            conversation_id=str(data["conversationId"]),
            content=[
                (
                    CloudApiCliAiV2StreamRequestContentItemAssistantTextInput.from_dict(
                        item
                    )
                    if isinstance(item, dict) and (item.get("type", None) == "text")
                    else CloudApiCliAiV2StreamRequestContentItemAssistantFileInput.from_dict(
                        item
                    )
                )
                for item in data["content"]
            ],
            tunnel_session_path=None
            if data.get("tunnelSessionPath") is None
            else str(data["tunnelSessionPath"]),
            secret_key=None
            if data.get("secretKey") is None
            else str(data["secretKey"]),
            human_approval=None
            if data.get("humanApproval") is None
            else str(data["humanApproval"]),
            tool_calls_approval=None
            if data.get("toolCallsApproval") is None
            else CloudApiCliAiV2StreamRequestToolCallsApproval.from_dict(
                data["toolCallsApproval"]
            ),
            email=None if data.get("email") is None else str(data["email"]),
            status=None if data.get("status") is None else data["status"],
            context=None if data.get("context") is None else dict(**data["context"]),
            browser_tools=None
            if data.get("browserTools") is None
            else [
                CloudApiConsoleBrowserToolsDefinition.from_dict(item)
                for item in data["browserTools"]
            ],
            browser_tool_responses=None
            if data.get("browserToolResponses") is None
            else [
                CloudApiConsoleBrowserToolsResponse.from_dict(item)
                for item in data["browserToolResponses"]
            ],
            auto_approve_tool_calls=None
            if data.get("autoApproveToolCalls") is None
            else bool(data["autoApproveToolCalls"]),
        )


CloudApiCliAiV2ConversationGetResponseId = str

CloudApiCliAiV2ConversationGetResponseCreatedAt = datetime.datetime

CloudApiCliAiV2ConversationGetResponseMessagesItemRole = typing.Union[
    typing.Literal["user"], typing.Literal["assistant"]
]

CloudApiCliAiV2ConversationGetResponseMessagesItemRoleValues: typing.List[
    CloudApiCliAiV2ConversationGetResponseMessagesItemRole
] = ["user", "assistant"]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent0 = str

CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0Type = typing.Literal[
    "text"
]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0TypeValues: typing.List[
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0Type
] = ["text"]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0Text = str


@dataclass
class CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0:
    type: CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0Type
    text: CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0Text

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["text"] = self.text
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0":
        return cls(
            type=data["type"],
            text=str(data["text"]),
        )


CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1Type = typing.Literal[
    "image_url"
]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1TypeValues: typing.List[
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1Type
] = ["image_url"]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrlUrl = str


@dataclass
class CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrl:
    url: CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrlUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["url"] = self.url
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrl":
        return cls(
            url=str(data["url"]),
        )


@dataclass
class CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1:
    type: CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1Type
    image_url: CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["image_url"] = self.image_url.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1":
        return cls(
            type=data["type"],
            image_url=CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1ImageUrl.from_dict(
                data["image_url"]
            ),
        )


CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item = typing.Union[
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0,
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1,
]


def cloud_api_cli_ai_v2_conversation_get_response_messages_item_content1_item_from_dict(
    data: typing.Any,
) -> "CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item":
    if isinstance(data, dict) and (data.get("type", None) == "text"):
        return (
            CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0.from_dict(
                data
            )
        )
    if isinstance(data, dict) and (data.get("type", None) == "image_url"):
        return (
            CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1.from_dict(
                data
            )
        )
    raise ValueError(
        f"Could not parse CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item from dict: {data}"
    )


CloudApiCliAiV2ConversationGetResponseMessagesItemContent1 = typing.List[
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item
]

CloudApiCliAiV2ConversationGetResponseMessagesItemContent = typing.Union[
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent0,
    CloudApiCliAiV2ConversationGetResponseMessagesItemContent1,
]


def cloud_api_cli_ai_v2_conversation_get_response_messages_item_content_from_dict(
    data: typing.Any,
) -> "CloudApiCliAiV2ConversationGetResponseMessagesItemContent":
    if isinstance(data, str):
        return str(data)
    if isinstance(data, list) and all(
        isinstance(item, dict)
        and (item.get("type", None) == "text")
        or isinstance(item, dict)
        and (item.get("type", None) == "image_url")
        for item in data
    ):
        return [
            (
                CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0.from_dict(
                    item
                )
                if isinstance(item, dict) and (item.get("type", None) == "text")
                else CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1.from_dict(
                    item
                )
            )
            for item in data
        ]
    raise ValueError(
        f"Could not parse CloudApiCliAiV2ConversationGetResponseMessagesItemContent from dict: {data}"
    )


CloudApiCliAiV2ConversationGetResponseMessagesItemCreatedAt = datetime.datetime

CloudApiCliAiV2ConversationGetResponseMessagesItemToolTitle = str

CloudApiCliAiV2ConversationGetResponseMessagesItemToolCallId = str


@dataclass
class CloudApiCliAiV2ConversationGetResponseMessagesItem:
    role: CloudApiCliAiV2ConversationGetResponseMessagesItemRole
    content: CloudApiCliAiV2ConversationGetResponseMessagesItemContent
    created_at: CloudApiCliAiV2ConversationGetResponseMessagesItemCreatedAt
    tool_title: typing.Optional[
        CloudApiCliAiV2ConversationGetResponseMessagesItemToolTitle
    ] = field(default_factory=lambda: None)
    tool_call_id: typing.Optional[
        CloudApiCliAiV2ConversationGetResponseMessagesItemToolCallId
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["role"] = self.role
        data["content"] = (
            self.content
            if isinstance(self.content, str)
            else [item.to_dict() for item in self.content]
        )
        data["createdAt"] = self.created_at.isoformat()
        if self.tool_title is not None:
            data["toolTitle"] = self.tool_title
        if self.tool_call_id is not None:
            data["toolCallId"] = self.tool_call_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationGetResponseMessagesItem":
        return cls(
            role=data["role"],
            content=(
                str(data["content"])
                if isinstance(data["content"], str)
                else [
                    (
                        CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item0.from_dict(
                            item
                        )
                        if isinstance(item, dict) and (item.get("type", None) == "text")
                        else CloudApiCliAiV2ConversationGetResponseMessagesItemContent1Item1.from_dict(
                            item
                        )
                    )
                    for item in data["content"]
                ]
            ),
            created_at=datetime.datetime.fromisoformat(data["createdAt"]),
            tool_title=None
            if data.get("toolTitle") is None
            else str(data["toolTitle"]),
            tool_call_id=None
            if data.get("toolCallId") is None
            else str(data["toolCallId"]),
        )


CloudApiCliAiV2ConversationGetResponseMessages = typing.List[
    CloudApiCliAiV2ConversationGetResponseMessagesItem
]


@dataclass
class CloudApiCliAiV2ConversationGetResponse:
    id: CloudApiCliAiV2ConversationGetResponseId
    created_at: CloudApiCliAiV2ConversationGetResponseCreatedAt
    messages: CloudApiCliAiV2ConversationGetResponseMessages

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["createdAt"] = self.created_at.isoformat()
        data["messages"] = [item.to_dict() for item in self.messages]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationGetResponse":
        return cls(
            id=str(data["id"]),
            created_at=datetime.datetime.fromisoformat(data["createdAt"]),
            messages=[
                CloudApiCliAiV2ConversationGetResponseMessagesItem.from_dict(item)
                for item in data["messages"]
            ],
        )


CloudApiCliAiV2ConversationsResponseItem = CloudApiCliAiV2ConversationGetResponse

CloudApiCliAiV2ConversationsResponse = typing.List[
    CloudApiCliAiV2ConversationsResponseItem
]

CloudApiCliAiV2ConversationPostRequestTunnelSessionPath = str

CloudApiCliAiV2ConversationPostRequestSecretKey = str


@dataclass
class CloudApiCliAiV2ConversationPostRequest:
    tunnel_session_path: CloudApiCliAiV2ConversationPostRequestTunnelSessionPath
    secret_key: CloudApiCliAiV2ConversationPostRequestSecretKey

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["tunnelSessionPath"] = self.tunnel_session_path
        data["secretKey"] = self.secret_key
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationPostRequest":
        return cls(
            tunnel_session_path=str(data["tunnelSessionPath"]),
            secret_key=str(data["secretKey"]),
        )


CloudApiCliAiV2ConversationPostResponseConversationId = str


@dataclass
class CloudApiCliAiV2ConversationPostResponse:
    conversation_id: CloudApiCliAiV2ConversationPostResponseConversationId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["conversationId"] = self.conversation_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2ConversationPostResponse":
        return cls(
            conversation_id=str(data["conversationId"]),
        )


CloudApiCliAiV2PromptPostRequestToolsItemType = typing.Literal["function"]

CloudApiCliAiV2PromptPostRequestToolsItemTypeValues: typing.List[
    CloudApiCliAiV2PromptPostRequestToolsItemType
] = ["function"]

CloudApiCliAiV2PromptPostRequestToolsItemFunctionName = str

CloudApiCliAiV2PromptPostRequestToolsItemFunctionParameters = typing.Dict[
    str, typing.Any
]

CloudApiCliAiV2PromptPostRequestToolsItemFunctionDescription = str


@dataclass
class CloudApiCliAiV2PromptPostRequestToolsItemFunction:
    name: CloudApiCliAiV2PromptPostRequestToolsItemFunctionName
    parameters: CloudApiCliAiV2PromptPostRequestToolsItemFunctionParameters
    description: typing.Optional[
        CloudApiCliAiV2PromptPostRequestToolsItemFunctionDescription
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["parameters"] = self.parameters
        if self.description is not None:
            data["description"] = self.description
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestToolsItemFunction":
        return cls(
            name=str(data["name"]),
            parameters=dict(**data["parameters"]),
            description=None
            if data.get("description") is None
            else str(data["description"]),
        )


@dataclass
class CloudApiCliAiV2PromptPostRequestToolsItem:
    type: CloudApiCliAiV2PromptPostRequestToolsItemType
    function: CloudApiCliAiV2PromptPostRequestToolsItemFunction

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["function"] = self.function.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequestToolsItem":
        return cls(
            type=data["type"],
            function=CloudApiCliAiV2PromptPostRequestToolsItemFunction.from_dict(
                data["function"]
            ),
        )


CloudApiCliAiV2PromptPostRequestTools = typing.List[
    CloudApiCliAiV2PromptPostRequestToolsItem
]

CloudApiCliAiV2PromptPostRequestTemperature = float


@dataclass
class CloudApiCliAiV2PromptPostRequest:
    messages: CloudApiCliAiV2PromptPostRequestMessages
    tools: CloudApiCliAiV2PromptPostRequestTools
    temperature: typing.Optional[CloudApiCliAiV2PromptPostRequestTemperature] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["messages"] = [item.to_dict() for item in self.messages]
        data["tools"] = [item.to_dict() for item in self.tools]
        if self.temperature is not None:
            data["temperature"] = self.temperature
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliAiV2PromptPostRequest":
        return cls(
            messages=[
                CloudApiCliAiV2PromptPostRequestMessagesItem.from_dict(item)
                for item in data["messages"]
            ],
            tools=[
                CloudApiCliAiV2PromptPostRequestToolsItem.from_dict(item)
                for item in data["tools"]
            ],
            temperature=None
            if data.get("temperature") is None
            else float(data["temperature"]),
        )


CloudApiCliTablesDumpResponse = CommonTablesSnapshot

CloudApiCliTablesRestoreRequest = CommonTablesSnapshot

CloudApiCliConnectorsSearchActionsResponseDataItem = str

CloudApiCliConnectorsSearchActionsResponseData = typing.List[
    CloudApiCliConnectorsSearchActionsResponseDataItem
]

CloudApiCliConnectorsSearchActionsResponsePage = int

CloudApiCliConnectorsSearchActionsResponsePageSize = int


@dataclass
class CloudApiCliConnectorsSearchActionsResponse:
    data: CloudApiCliConnectorsSearchActionsResponseData
    page: CloudApiCliConnectorsSearchActionsResponsePage
    page_size: CloudApiCliConnectorsSearchActionsResponsePageSize

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["data"] = self.data
        data["page"] = self.page
        data["pageSize"] = self.page_size
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsSearchActionsResponse":
        return cls(
            data=[str(item) for item in data["data"]],
            page=int(data["page"]),
            page_size=int(data["pageSize"]),
        )


CloudApiCliConnectorsGetActionResponseName = str

CloudApiCliConnectorsGetActionResponseDescription = str

CloudApiCliConnectorsGetActionResponsePayloadSchema = typing.Dict[str, typing.Any]

CloudApiCliConnectorsGetActionResponseReturnType = str

CloudApiCliConnectorsGetActionResponseReturnSchema = typing.Dict[str, typing.Any]


@dataclass
class CloudApiCliConnectorsGetActionResponse:
    name: CloudApiCliConnectorsGetActionResponseName
    description: CloudApiCliConnectorsGetActionResponseDescription
    payload_schema: CloudApiCliConnectorsGetActionResponsePayloadSchema
    return_type: typing.Optional[CloudApiCliConnectorsGetActionResponseReturnType] = (
        field(default_factory=lambda: None)
    )
    return_schema: typing.Optional[
        CloudApiCliConnectorsGetActionResponseReturnSchema
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["description"] = self.description
        data["payloadSchema"] = self.payload_schema
        if self.return_type is not None:
            data["returnType"] = self.return_type
        if self.return_schema is not None:
            data["returnSchema"] = self.return_schema
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsGetActionResponse":
        return cls(
            name=str(data["name"]),
            description=str(data["description"]),
            payload_schema=dict(**data["payloadSchema"]),
            return_type=None
            if data.get("returnType") is None
            else str(data["returnType"]),
            return_schema=None
            if data.get("returnSchema") is None
            else dict(**data["returnSchema"]),
        )


CloudApiCliConnectorsConnectionsResponseItemName = str

CloudApiCliConnectorsConnectionsResponseItemConnectionType = str


@dataclass
class CloudApiCliConnectorsConnectionsResponseItem:
    name: CloudApiCliConnectorsConnectionsResponseItemName
    connection_type: CloudApiCliConnectorsConnectionsResponseItemConnectionType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["connectionType"] = self.connection_type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsConnectionsResponseItem":
        return cls(
            name=str(data["name"]),
            connection_type=str(data["connectionType"]),
        )


CloudApiCliConnectorsConnectionsResponse = typing.List[
    CloudApiCliConnectorsConnectionsResponseItem
]

CloudApiCliConnectorsExecuteRequestConnectionName = str

CloudApiCliConnectorsExecuteRequestActionName = str

CloudApiCliConnectorsExecuteRequestParameters = typing.Dict[str, typing.Any]


@dataclass
class CloudApiCliConnectorsExecuteRequest:
    connection_name: CloudApiCliConnectorsExecuteRequestConnectionName
    action_name: CloudApiCliConnectorsExecuteRequestActionName
    parameters: typing.Optional[CloudApiCliConnectorsExecuteRequestParameters] = field(
        default_factory=lambda: {}
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["connectionName"] = self.connection_name
        data["actionName"] = self.action_name
        if self.parameters is not None:
            data["parameters"] = self.parameters
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsExecuteRequest":
        return cls(
            connection_name=str(data["connectionName"]),
            action_name=str(data["actionName"]),
            parameters=None
            if data.get("parameters") is None
            else dict(**data["parameters"]),
        )


CloudApiCliConnectorsExecuteResponse0Status = typing.Literal["success"]

CloudApiCliConnectorsExecuteResponse0StatusValues: typing.List[
    CloudApiCliConnectorsExecuteResponse0Status
] = ["success"]

CloudApiCliConnectorsExecuteResponse0Data = typing.Dict[str, typing.Any]


@dataclass
class CloudApiCliConnectorsExecuteResponse0:
    status: CloudApiCliConnectorsExecuteResponse0Status
    data: CloudApiCliConnectorsExecuteResponse0Data

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["status"] = self.status
        data["data"] = self.data
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsExecuteResponse0":
        return cls(
            status=data["status"],
            data=dict(**data["data"]),
        )


CloudApiCliConnectorsExecuteResponse1Status = typing.Literal["error"]

CloudApiCliConnectorsExecuteResponse1StatusValues: typing.List[
    CloudApiCliConnectorsExecuteResponse1Status
] = ["error"]

CloudApiCliConnectorsExecuteResponse1Message = str


@dataclass
class CloudApiCliConnectorsExecuteResponse1:
    status: CloudApiCliConnectorsExecuteResponse1Status
    message: CloudApiCliConnectorsExecuteResponse1Message

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["status"] = self.status
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "CloudApiCliConnectorsExecuteResponse1":
        return cls(
            status=data["status"],
            message=str(data["message"]),
        )


CloudApiCliConnectorsExecuteResponse = typing.Union[
    CloudApiCliConnectorsExecuteResponse0, CloudApiCliConnectorsExecuteResponse1
]


def cloud_api_cli_connectors_execute_response_from_dict(
    data: typing.Any,
) -> "CloudApiCliConnectorsExecuteResponse":
    if isinstance(data, dict) and (data.get("status", None) == "success"):
        return CloudApiCliConnectorsExecuteResponse0.from_dict(data)
    if isinstance(data, dict) and (data.get("status", None) == "error"):
        return CloudApiCliConnectorsExecuteResponse1.from_dict(data)
    raise ValueError(
        f"Could not parse CloudApiCliConnectorsExecuteResponse from dict: {data}"
    )


AbstraLibApiStageCardContentKey = str

AbstraLibApiStageCardContentValue = typing.Dict[str, typing.Any]

AbstraLibApiStageCardContentType = str


@dataclass
class AbstraLibApiStageCardContent:
    key: AbstraLibApiStageCardContentKey
    value: AbstraLibApiStageCardContentValue
    type: AbstraLibApiStageCardContentType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["value"] = self.value
        data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiStageCardContent":
        return cls(
            key=str(data["key"]),
            value=dict(**data["value"]),
            type=str(data["type"]),
        )


AbstraLibApiStageCardContentsItem = AbstraLibApiStageCardContent

AbstraLibApiStageCardContents = typing.List[AbstraLibApiStageCardContentsItem]

AbstraLibApiStageRunId = str

AbstraLibApiStageRunStage = str

AbstraLibApiStageRunData = typing.Dict[str, typing.Any]

AbstraLibApiStageRunStatus = typing.Union[
    typing.Literal["waiting"],
    typing.Literal["running"],
    typing.Literal["processing"],
    typing.Literal["finished"],
    typing.Literal["failed"],
    typing.Literal["abandoned"],
]

AbstraLibApiStageRunStatusValues: typing.List[AbstraLibApiStageRunStatus] = [
    "waiting",
    "running",
    "processing",
    "finished",
    "failed",
    "abandoned",
]

AbstraLibApiStageRunCreatedAt = str

AbstraLibApiStageRunUpdatedAt = str

AbstraLibApiStageRunParentId = str

AbstraLibApiStageRunExecutionId = str


@dataclass
class AbstraLibApiStageRun:
    id: AbstraLibApiStageRunId
    stage: AbstraLibApiStageRunStage
    data: AbstraLibApiStageRunData
    status: AbstraLibApiStageRunStatus
    created_at: AbstraLibApiStageRunCreatedAt
    updated_at: AbstraLibApiStageRunUpdatedAt
    parent_id: typing.Optional[AbstraLibApiStageRunParentId] = field(
        default_factory=lambda: None
    )
    execution_id: typing.Optional[AbstraLibApiStageRunExecutionId] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["stage"] = self.stage
        data["data"] = self.data
        data["status"] = self.status
        data["created_at"] = self.created_at
        data["updated_at"] = self.updated_at
        if self.parent_id is not None:
            data["parent_id"] = self.parent_id
        if self.execution_id is not None:
            data["execution_id"] = self.execution_id
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "AbstraLibApiStageRun":
        return cls(
            id=str(data["id"]),
            stage=str(data["stage"]),
            data=dict(**data["data"]),
            status=data["status"],
            created_at=str(data["created_at"]),
            updated_at=str(data["updated_at"]),
            parent_id=None if data.get("parent_id") is None else str(data["parent_id"]),
            execution_id=None
            if data.get("execution_id") is None
            else str(data["execution_id"]),
        )


AbstraLibApiStageRunCardId = str

AbstraLibApiStageRunCardCreatedAt = str

AbstraLibApiStageRunCardUpdatedAt = str

AbstraLibApiStageRunCardAssignee = str

AbstraLibApiStageRunCardStatus = AbstraLibApiStageRunStatus

AbstraLibApiStageRunCardContent = AbstraLibApiStageCardContents

AbstraLibApiStageRunCardStage = str


@dataclass
class AbstraLibApiStageRunCard:
    id: AbstraLibApiStageRunCardId
    created_at: AbstraLibApiStageRunCardCreatedAt
    status: AbstraLibApiStageRunCardStatus
    content: AbstraLibApiStageRunCardContent
    updated_at: typing.Optional[AbstraLibApiStageRunCardUpdatedAt] = field(
        default_factory=lambda: None
    )
    assignee: typing.Optional[AbstraLibApiStageRunCardAssignee] = field(
        default_factory=lambda: None
    )
    stage: typing.Optional[AbstraLibApiStageRunCardStage] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["created_at"] = self.created_at
        data["status"] = self.status
        data["content"] = [item.to_dict() for item in self.content]
        if self.updated_at is not None:
            data["updated_at"] = self.updated_at
        if self.assignee is not None:
            data["assignee"] = self.assignee
        if self.stage is not None:
            data["stage"] = self.stage
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiStageRunCard":
        return cls(
            id=str(data["id"]),
            created_at=str(data["created_at"]),
            status=data["status"],
            content=[
                AbstraLibApiStageCardContent.from_dict(item) for item in data["content"]
            ],
            updated_at=None
            if data.get("updated_at") is None
            else str(data["updated_at"]),
            assignee=None if data.get("assignee") is None else str(data["assignee"]),
            stage=None if data.get("stage") is None else str(data["stage"]),
        )


AbstraLibApiStageRunCardsItem = AbstraLibApiStageRunCard

AbstraLibApiStageRunCards = typing.List[AbstraLibApiStageRunCardsItem]

AbstraLibApiStageId = str

AbstraLibApiStageType = typing.Union[
    typing.Literal["form"],
    typing.Literal["hook"],
    typing.Literal["job"],
    typing.Literal["script"],
    typing.Literal["agent"],
    typing.Literal["page"],
]

AbstraLibApiStageTypeValues: typing.List[AbstraLibApiStageType] = [
    "form",
    "hook",
    "job",
    "script",
    "agent",
    "page",
]

AbstraLibApiStageTitle = str

AbstraLibApiStagePath = str

AbstraLibApiStageCanBeStarted = bool


@dataclass
class AbstraLibApiStage:
    id: AbstraLibApiStageId
    type: AbstraLibApiStageType
    title: AbstraLibApiStageTitle
    can_be_started: AbstraLibApiStageCanBeStarted
    path: typing.Optional[AbstraLibApiStagePath] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["id"] = self.id
        data["type"] = self.type
        data["title"] = self.title
        data["can_be_started"] = self.can_be_started
        if self.path is not None:
            data["path"] = self.path
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "AbstraLibApiStage":
        return cls(
            id=str(data["id"]),
            type=data["type"],
            title=str(data["title"]),
            can_be_started=bool(data["can_be_started"]),
            path=None if data.get("path") is None else str(data["path"]),
        )


AbstraLibApiKanbanColumnSelectedStage = AbstraLibApiStage

AbstraLibApiKanbanColumnStageRunCards = AbstraLibApiStageRunCards

AbstraLibApiKanbanColumnTotalCount = int

AbstraLibApiKanbanColumnLoading = bool


@dataclass
class AbstraLibApiKanbanColumn:
    selected_stage: AbstraLibApiKanbanColumnSelectedStage
    stage_run_cards: AbstraLibApiKanbanColumnStageRunCards
    total_count: AbstraLibApiKanbanColumnTotalCount
    loading: typing.Optional[AbstraLibApiKanbanColumnLoading] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["selected_stage"] = self.selected_stage.to_dict()
        data["stage_run_cards"] = [item.to_dict() for item in self.stage_run_cards]
        data["total_count"] = self.total_count
        if self.loading is not None:
            data["loading"] = self.loading
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiKanbanColumn":
        return cls(
            selected_stage=AbstraLibApiStage.from_dict(data["selected_stage"]),
            stage_run_cards=[
                AbstraLibApiStageRunCard.from_dict(item)
                for item in data["stage_run_cards"]
            ],
            total_count=int(data["total_count"]),
            loading=None if data.get("loading") is None else bool(data["loading"]),
        )


AbstraLibApiKanbanColumnsItem = AbstraLibApiKanbanColumn

AbstraLibApiKanbanColumns = typing.List[AbstraLibApiKanbanColumnsItem]

AbstraLibApiKanbanDataColumns = AbstraLibApiKanbanColumns


@dataclass
class AbstraLibApiKanbanData:
    columns: AbstraLibApiKanbanDataColumns

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["columns"] = [item.to_dict() for item in self.columns]
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "AbstraLibApiKanbanData":
        return cls(
            columns=[
                AbstraLibApiKanbanColumn.from_dict(item) for item in data["columns"]
            ],
        )


AbstraLibApiThreadsStageRunCards = AbstraLibApiStageRunCards

AbstraLibApiThreadsNotFoundStagesItem = str

AbstraLibApiThreadsNotFoundStages = typing.List[AbstraLibApiThreadsNotFoundStagesItem]

AbstraLibApiThreadsTotalCount = int


@dataclass
class AbstraLibApiThreads:
    stage_run_cards: AbstraLibApiThreadsStageRunCards
    not_found_stages: AbstraLibApiThreadsNotFoundStages
    total_count: AbstraLibApiThreadsTotalCount

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["stage_run_cards"] = [item.to_dict() for item in self.stage_run_cards]
        data["not_found_stages"] = self.not_found_stages
        data["total_count"] = self.total_count
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "AbstraLibApiThreads":
        return cls(
            stage_run_cards=[
                AbstraLibApiStageRunCard.from_dict(item)
                for item in data["stage_run_cards"]
            ],
            not_found_stages=[str(item) for item in data["not_found_stages"]],
            total_count=int(data["total_count"]),
        )


AbstraLibApiStagesItem = AbstraLibApiStage

AbstraLibApiStages = typing.List[AbstraLibApiStagesItem]

AbstraLibApiPlayerUserSignupEmail = CommonUserEmail


@dataclass
class AbstraLibApiPlayerUserSignup:
    email: AbstraLibApiPlayerUserSignupEmail

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["email"] = self.email
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiPlayerUserSignup":
        return cls(
            email=str(data["email"]),
        )


AbstraLibApiPlayerUserNavigationGuardStatus = typing.Union[
    typing.Literal["ALLOWED"],
    typing.Literal["UNAUTHORIZED"],
    typing.Literal["FORBIDEN"],
    typing.Literal["NOT_FOUND"],
]

AbstraLibApiPlayerUserNavigationGuardStatusValues: typing.List[
    AbstraLibApiPlayerUserNavigationGuardStatus
] = ["ALLOWED", "UNAUTHORIZED", "FORBIDEN", "NOT_FOUND"]


@dataclass
class AbstraLibApiPlayerUserNavigationGuard:
    status: AbstraLibApiPlayerUserNavigationGuardStatus

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["status"] = self.status
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiPlayerUserNavigationGuard":
        return cls(
            status=data["status"],
        )


AbstraLibApiEditorCodebaseEventsMessageFilepath = str

AbstraLibApiEditorCodebaseEventsMessageEvent = typing.Union[
    typing.Literal["changed"],
    typing.Literal["created"],
    typing.Literal["deleted"],
    typing.Literal["moved"],
]

AbstraLibApiEditorCodebaseEventsMessageEventValues: typing.List[
    AbstraLibApiEditorCodebaseEventsMessageEvent
] = ["changed", "created", "deleted", "moved"]

AbstraLibApiEditorCodebaseEventsMessageContent = str


@dataclass
class AbstraLibApiEditorCodebaseEventsMessage:
    filepath: AbstraLibApiEditorCodebaseEventsMessageFilepath
    event: AbstraLibApiEditorCodebaseEventsMessageEvent
    content: typing.Optional[AbstraLibApiEditorCodebaseEventsMessageContent] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["filepath"] = self.filepath
        data["event"] = self.event
        if self.content is not None:
            data["content"] = self.content
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseEventsMessage":
        return cls(
            filepath=str(data["filepath"]),
            event=data["event"],
            content=None if data.get("content") is None else str(data["content"]),
        )


AbstraLibApiEditorLintersRuleName = str

AbstraLibApiEditorLintersRuleLabel = str

AbstraLibApiEditorLintersRuleType = typing.Literal["bug"]

AbstraLibApiEditorLintersRuleTypeValues: typing.List[
    AbstraLibApiEditorLintersRuleType
] = ["bug"]

AbstraLibApiEditorLintersIssueLabel = str

AbstraLibApiEditorLintersFixName = str

AbstraLibApiEditorLintersFixLabel = str


@dataclass
class AbstraLibApiEditorLintersFix:
    name: AbstraLibApiEditorLintersFixName
    label: AbstraLibApiEditorLintersFixLabel

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["label"] = self.label
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorLintersFix":
        return cls(
            name=str(data["name"]),
            label=str(data["label"]),
        )


AbstraLibApiEditorLintersIssueFixesItem = AbstraLibApiEditorLintersFix

AbstraLibApiEditorLintersIssueFixes = typing.List[
    AbstraLibApiEditorLintersIssueFixesItem
]


@dataclass
class AbstraLibApiEditorLintersIssue:
    label: AbstraLibApiEditorLintersIssueLabel
    fixes: AbstraLibApiEditorLintersIssueFixes

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["label"] = self.label
        data["fixes"] = [item.to_dict() for item in self.fixes]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorLintersIssue":
        return cls(
            label=str(data["label"]),
            fixes=[
                AbstraLibApiEditorLintersFix.from_dict(item) for item in data["fixes"]
            ],
        )


AbstraLibApiEditorLintersRuleIssuesItem = AbstraLibApiEditorLintersIssue

AbstraLibApiEditorLintersRuleIssues = typing.List[
    AbstraLibApiEditorLintersRuleIssuesItem
]

AbstraLibApiEditorLintersRuleFixWithAi = bool


@dataclass
class AbstraLibApiEditorLintersRule:
    name: AbstraLibApiEditorLintersRuleName
    label: AbstraLibApiEditorLintersRuleLabel
    type: AbstraLibApiEditorLintersRuleType
    issues: AbstraLibApiEditorLintersRuleIssues
    fix_with_ai: AbstraLibApiEditorLintersRuleFixWithAi

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["label"] = self.label
        data["type"] = self.type
        data["issues"] = [item.to_dict() for item in self.issues]
        data["fixWithAi"] = self.fix_with_ai
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorLintersRule":
        return cls(
            name=str(data["name"]),
            label=str(data["label"]),
            type=data["type"],
            issues=[
                AbstraLibApiEditorLintersIssue.from_dict(item)
                for item in data["issues"]
            ],
            fix_with_ai=bool(data["fixWithAi"]),
        )


AbstraLibApiEditorWebEditorResponseWaitingRoomUrl = str


@dataclass
class AbstraLibApiEditorWebEditorResponse:
    waiting_room_url: AbstraLibApiEditorWebEditorResponseWaitingRoomUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["waitingRoomUrl"] = self.waiting_room_url
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorWebEditorResponse":
        return cls(
            waiting_room_url=str(data["waitingRoomUrl"]),
        )


AbstraLibApiEditorEnvVarsModelName = str

AbstraLibApiEditorEnvVarsModelValue = str


@dataclass
class AbstraLibApiEditorEnvVarsModel:
    name: AbstraLibApiEditorEnvVarsModelName
    value: AbstraLibApiEditorEnvVarsModelValue

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["name"] = self.name
        data["value"] = self.value
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorEnvVarsModel":
        return cls(
            name=str(data["name"]),
            value=str(data["value"]),
        )


AbstraLibApiEditorGitLargeFilePath = str

AbstraLibApiEditorGitLargeFileSizeBytes = int

AbstraLibApiEditorGitLargeFileSizeHuman = str


@dataclass
class AbstraLibApiEditorGitLargeFile:
    path: AbstraLibApiEditorGitLargeFilePath
    size_bytes: AbstraLibApiEditorGitLargeFileSizeBytes
    size_human: AbstraLibApiEditorGitLargeFileSizeHuman

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["path"] = self.path
        data["sizeBytes"] = self.size_bytes
        data["sizeHuman"] = self.size_human
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitLargeFile":
        return cls(
            path=str(data["path"]),
            size_bytes=int(data["sizeBytes"]),
            size_human=str(data["sizeHuman"]),
        )


AbstraLibApiEditorGitCommitRequestMessage = str


@dataclass
class AbstraLibApiEditorGitCommitRequest:
    message: AbstraLibApiEditorGitCommitRequestMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitCommitRequest":
        return cls(
            message=str(data["message"]),
        )


AbstraLibApiEditorGitCommitResponseSuccess = bool

AbstraLibApiEditorGitCommitResponseMessage = str

AbstraLibApiEditorGitCommitResponseErrorType = typing.Union[
    typing.Literal["large_files"], typing.Literal["large_files_push"]
]

AbstraLibApiEditorGitCommitResponseErrorTypeValues: typing.List[
    AbstraLibApiEditorGitCommitResponseErrorType
] = ["large_files", "large_files_push"]

AbstraLibApiEditorGitCommitResponseLargeFilesItem = AbstraLibApiEditorGitLargeFile

AbstraLibApiEditorGitCommitResponseLargeFiles = typing.List[
    AbstraLibApiEditorGitCommitResponseLargeFilesItem
]


@dataclass
class AbstraLibApiEditorGitCommitResponse:
    success: AbstraLibApiEditorGitCommitResponseSuccess
    message: AbstraLibApiEditorGitCommitResponseMessage
    error_type: typing.Optional[AbstraLibApiEditorGitCommitResponseErrorType] = field(
        default_factory=lambda: None
    )
    large_files: typing.Optional[AbstraLibApiEditorGitCommitResponseLargeFiles] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        if self.error_type is not None:
            data["errorType"] = self.error_type
        if self.large_files is not None:
            data["largeFiles"] = [item.to_dict() for item in self.large_files]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitCommitResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
            error_type=None if data.get("errorType") is None else data["errorType"],
            large_files=None
            if data.get("largeFiles") is None
            else [
                AbstraLibApiEditorGitLargeFile.from_dict(item)
                for item in data["largeFiles"]
            ],
        )


AbstraLibApiEditorGitRevertRequestCommitHash = str


@dataclass
class AbstraLibApiEditorGitRevertRequest:
    commit_hash: AbstraLibApiEditorGitRevertRequestCommitHash

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["commitHash"] = self.commit_hash
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitRevertRequest":
        return cls(
            commit_hash=str(data["commitHash"]),
        )


AbstraLibApiEditorGitRevertResponseSuccess = bool

AbstraLibApiEditorGitRevertResponseMessage = str


@dataclass
class AbstraLibApiEditorGitRevertResponse:
    success: AbstraLibApiEditorGitRevertResponseSuccess
    message: AbstraLibApiEditorGitRevertResponseMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitRevertResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
        )


AbstraLibApiEditorGitDeployResponseSuccess = bool

AbstraLibApiEditorGitDeployResponseMessage = str

AbstraLibApiEditorGitDeployResponseErrorType = typing.Union[
    typing.Literal["large_files"], typing.Literal["large_files_push"]
]

AbstraLibApiEditorGitDeployResponseErrorTypeValues: typing.List[
    AbstraLibApiEditorGitDeployResponseErrorType
] = ["large_files", "large_files_push"]

AbstraLibApiEditorGitDeployResponseLargeFilesItem = AbstraLibApiEditorGitLargeFile

AbstraLibApiEditorGitDeployResponseLargeFiles = typing.List[
    AbstraLibApiEditorGitDeployResponseLargeFilesItem
]


@dataclass
class AbstraLibApiEditorGitDeployResponse:
    success: AbstraLibApiEditorGitDeployResponseSuccess
    message: AbstraLibApiEditorGitDeployResponseMessage
    error_type: typing.Optional[AbstraLibApiEditorGitDeployResponseErrorType] = field(
        default_factory=lambda: None
    )
    large_files: typing.Optional[AbstraLibApiEditorGitDeployResponseLargeFiles] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        if self.error_type is not None:
            data["errorType"] = self.error_type
        if self.large_files is not None:
            data["largeFiles"] = [item.to_dict() for item in self.large_files]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitDeployResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
            error_type=None if data.get("errorType") is None else data["errorType"],
            large_files=None
            if data.get("largeFiles") is None
            else [
                AbstraLibApiEditorGitLargeFile.from_dict(item)
                for item in data["largeFiles"]
            ],
        )


AbstraLibApiEditorGitPullResponseSuccess = bool

AbstraLibApiEditorGitPullResponseMessage = str


@dataclass
class AbstraLibApiEditorGitPullResponse:
    success: AbstraLibApiEditorGitPullResponseSuccess
    message: AbstraLibApiEditorGitPullResponseMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitPullResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
        )


AbstraLibApiEditorGitGetRemotesResponseRemotesAdditionalProperty = str

AbstraLibApiEditorGitGetRemotesResponseRemotes = typing.Dict[str, str]

AbstraLibApiEditorGitGetRemotesResponseHasAbstraRemote = bool


@dataclass
class AbstraLibApiEditorGitGetRemotesResponse:
    remotes: AbstraLibApiEditorGitGetRemotesResponseRemotes
    has_abstra_remote: AbstraLibApiEditorGitGetRemotesResponseHasAbstraRemote

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["remotes"] = self.remotes
        data["hasAbstraRemote"] = self.has_abstra_remote
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetRemotesResponse":
        return cls(
            remotes=dict(**data["remotes"]),
            has_abstra_remote=bool(data["hasAbstraRemote"]),
        )


AbstraLibApiEditorGitCheckoutRequestBranch = str

AbstraLibApiEditorGitCheckoutRequestCommitHash = str


@dataclass
class AbstraLibApiEditorGitCheckoutRequest:
    branch: typing.Optional[AbstraLibApiEditorGitCheckoutRequestBranch] = field(
        default_factory=lambda: None
    )
    commit_hash: typing.Optional[AbstraLibApiEditorGitCheckoutRequestCommitHash] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.branch is not None:
            data["branch"] = self.branch
        if self.commit_hash is not None:
            data["commitHash"] = self.commit_hash
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitCheckoutRequest":
        return cls(
            branch=None if data.get("branch") is None else str(data["branch"]),
            commit_hash=None
            if data.get("commitHash") is None
            else str(data["commitHash"]),
        )


AbstraLibApiEditorGitCheckoutResponseSuccess = bool

AbstraLibApiEditorGitCheckoutResponseMessage = str


@dataclass
class AbstraLibApiEditorGitCheckoutResponse:
    success: AbstraLibApiEditorGitCheckoutResponseSuccess
    message: AbstraLibApiEditorGitCheckoutResponseMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitCheckoutResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
        )


AbstraLibApiEditorGitGetStatusResponseAvailable = bool

AbstraLibApiEditorGitGetStatusResponseGitInstalled = bool

AbstraLibApiEditorGitGetStatusResponseIsMonorepo = bool

AbstraLibApiEditorGitGetStatusResponseBranch = str

AbstraLibApiEditorGitGetStatusResponseBranchesItem = str

AbstraLibApiEditorGitGetStatusResponseBranches = typing.List[
    AbstraLibApiEditorGitGetStatusResponseBranchesItem
]

AbstraLibApiEditorGitGetStatusResponseLastCommitHash = str

AbstraLibApiEditorGitGetStatusResponseLastCommitMessage = str

AbstraLibApiEditorGitGetStatusResponseLastCommitAuthor = str

AbstraLibApiEditorGitGetStatusResponseLastCommitDate = str


@dataclass
class AbstraLibApiEditorGitGetStatusResponseLastCommit:
    hash: AbstraLibApiEditorGitGetStatusResponseLastCommitHash
    message: AbstraLibApiEditorGitGetStatusResponseLastCommitMessage
    author: AbstraLibApiEditorGitGetStatusResponseLastCommitAuthor
    date: AbstraLibApiEditorGitGetStatusResponseLastCommitDate

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["hash"] = self.hash
        data["message"] = self.message
        data["author"] = self.author
        data["date"] = self.date
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetStatusResponseLastCommit":
        return cls(
            hash=str(data["hash"]),
            message=str(data["message"]),
            author=str(data["author"]),
            date=str(data["date"]),
        )


AbstraLibApiEditorGitGetStatusResponseHasChanges = bool

AbstraLibApiEditorGitGetStatusResponseChangedFilesItem = str

AbstraLibApiEditorGitGetStatusResponseChangedFiles = typing.List[
    AbstraLibApiEditorGitGetStatusResponseChangedFilesItem
]

AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemPath = str

AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemStatus = str

AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemStatusCode = str


@dataclass
class AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItem:
    path: AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemPath
    status: AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemStatus
    status_code: (
        AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItemStatusCode
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["path"] = self.path
        data["status"] = self.status
        data["statusCode"] = self.status_code
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItem":
        return cls(
            path=str(data["path"]),
            status=str(data["status"]),
            status_code=str(data["statusCode"]),
        )


AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatus = typing.List[
    AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItem
]

AbstraLibApiEditorGitGetStatusResponseRemoteStatusSuccess = bool

AbstraLibApiEditorGitGetStatusResponseRemoteStatusRemoteCommit = str

AbstraLibApiEditorGitGetStatusResponseRemoteStatusHasRemoteChanges = bool

AbstraLibApiEditorGitGetStatusResponseRemoteStatusHasConflicts = bool

AbstraLibApiEditorGitGetStatusResponseRemoteStatusMessage = str

AbstraLibApiEditorGitGetStatusResponseRemoteStatusAvailableBranchesItem = str

AbstraLibApiEditorGitGetStatusResponseRemoteStatusAvailableBranches = typing.List[
    AbstraLibApiEditorGitGetStatusResponseRemoteStatusAvailableBranchesItem
]

AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehindAhead = int

AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehindBehind = int


@dataclass
class AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehind:
    ahead: AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehindAhead
    behind: AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehindBehind

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["ahead"] = self.ahead
        data["behind"] = self.behind
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehind":
        return cls(
            ahead=int(data["ahead"]),
            behind=int(data["behind"]),
        )


@dataclass
class AbstraLibApiEditorGitGetStatusResponseRemoteStatus:
    success: AbstraLibApiEditorGitGetStatusResponseRemoteStatusSuccess
    remote_commit: AbstraLibApiEditorGitGetStatusResponseRemoteStatusRemoteCommit
    has_remote_changes: (
        AbstraLibApiEditorGitGetStatusResponseRemoteStatusHasRemoteChanges
    )
    has_conflicts: AbstraLibApiEditorGitGetStatusResponseRemoteStatusHasConflicts
    message: AbstraLibApiEditorGitGetStatusResponseRemoteStatusMessage
    available_branches: (
        AbstraLibApiEditorGitGetStatusResponseRemoteStatusAvailableBranches
    )
    ahead_behind: AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehind

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["remoteCommit"] = self.remote_commit
        data["hasRemoteChanges"] = self.has_remote_changes
        data["hasConflicts"] = self.has_conflicts
        data["message"] = self.message
        data["availableBranches"] = self.available_branches
        data["aheadBehind"] = self.ahead_behind.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetStatusResponseRemoteStatus":
        return cls(
            success=bool(data["success"]),
            remote_commit=str(data["remoteCommit"]),
            has_remote_changes=bool(data["hasRemoteChanges"]),
            has_conflicts=bool(data["hasConflicts"]),
            message=str(data["message"]),
            available_branches=[str(item) for item in data["availableBranches"]],
            ahead_behind=AbstraLibApiEditorGitGetStatusResponseRemoteStatusAheadBehind.from_dict(
                data["aheadBehind"]
            ),
        )


@dataclass
class AbstraLibApiEditorGitGetStatusResponse:
    available: AbstraLibApiEditorGitGetStatusResponseAvailable
    git_installed: AbstraLibApiEditorGitGetStatusResponseGitInstalled
    is_monorepo: AbstraLibApiEditorGitGetStatusResponseIsMonorepo
    branch: AbstraLibApiEditorGitGetStatusResponseBranch
    branches: AbstraLibApiEditorGitGetStatusResponseBranches
    last_commit: AbstraLibApiEditorGitGetStatusResponseLastCommit
    has_changes: AbstraLibApiEditorGitGetStatusResponseHasChanges
    changed_files: AbstraLibApiEditorGitGetStatusResponseChangedFiles
    changed_files_with_status: (
        AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatus
    )
    remote_status: AbstraLibApiEditorGitGetStatusResponseRemoteStatus

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["available"] = self.available
        data["gitInstalled"] = self.git_installed
        data["isMonorepo"] = self.is_monorepo
        data["branch"] = self.branch
        data["branches"] = self.branches
        data["lastCommit"] = self.last_commit.to_dict()
        data["hasChanges"] = self.has_changes
        data["changedFiles"] = self.changed_files
        data["changedFilesWithStatus"] = [
            item.to_dict() for item in self.changed_files_with_status
        ]
        data["remoteStatus"] = self.remote_status.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetStatusResponse":
        return cls(
            available=bool(data["available"]),
            git_installed=bool(data["gitInstalled"]),
            is_monorepo=bool(data["isMonorepo"]),
            branch=str(data["branch"]),
            branches=[str(item) for item in data["branches"]],
            last_commit=AbstraLibApiEditorGitGetStatusResponseLastCommit.from_dict(
                data["lastCommit"]
            ),
            has_changes=bool(data["hasChanges"]),
            changed_files=[str(item) for item in data["changedFiles"]],
            changed_files_with_status=[
                AbstraLibApiEditorGitGetStatusResponseChangedFilesWithStatusItem.from_dict(
                    item
                )
                for item in data["changedFilesWithStatus"]
            ],
            remote_status=AbstraLibApiEditorGitGetStatusResponseRemoteStatus.from_dict(
                data["remoteStatus"]
            ),
        )


AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemHash = str

AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemMessage = str

AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemAuthor = str

AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemDate = str


@dataclass
class AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItem:
    hash: AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemHash
    message: AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemMessage
    author: AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemAuthor
    date: AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItemDate

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["hash"] = self.hash
        data["message"] = self.message
        data["author"] = self.author
        data["date"] = self.date
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItem":
        return cls(
            hash=str(data["hash"]),
            message=str(data["message"]),
            author=str(data["author"]),
            date=str(data["date"]),
        )


AbstraLibApiEditorGitGetCommitHistoryResponseCommits = typing.List[
    AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItem
]

AbstraLibApiEditorGitGetCommitHistoryResponseHasMore = bool


@dataclass
class AbstraLibApiEditorGitGetCommitHistoryResponse:
    commits: AbstraLibApiEditorGitGetCommitHistoryResponseCommits
    has_more: AbstraLibApiEditorGitGetCommitHistoryResponseHasMore

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["commits"] = [item.to_dict() for item in self.commits]
        data["hasMore"] = self.has_more
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitGetCommitHistoryResponse":
        return cls(
            commits=[
                AbstraLibApiEditorGitGetCommitHistoryResponseCommitsItem.from_dict(item)
                for item in data["commits"]
            ],
            has_more=bool(data["hasMore"]),
        )


AbstraLibApiEditorGitStashResponseSuccess = bool

AbstraLibApiEditorGitStashResponseMessage = str


@dataclass
class AbstraLibApiEditorGitStashResponse:
    success: AbstraLibApiEditorGitStashResponseSuccess
    message: AbstraLibApiEditorGitStashResponseMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitStashResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
        )


AbstraLibApiEditorGitAddToGitignoreRequestPathsItem = str

AbstraLibApiEditorGitAddToGitignoreRequestPaths = typing.List[
    AbstraLibApiEditorGitAddToGitignoreRequestPathsItem
]


@dataclass
class AbstraLibApiEditorGitAddToGitignoreRequest:
    paths: AbstraLibApiEditorGitAddToGitignoreRequestPaths

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["paths"] = self.paths
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitAddToGitignoreRequest":
        return cls(
            paths=[str(item) for item in data["paths"]],
        )


AbstraLibApiEditorGitAddToGitignoreResponseSuccess = bool

AbstraLibApiEditorGitAddToGitignoreResponseMessage = str


@dataclass
class AbstraLibApiEditorGitAddToGitignoreResponse:
    success: AbstraLibApiEditorGitAddToGitignoreResponseSuccess
    message: AbstraLibApiEditorGitAddToGitignoreResponseMessage

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorGitAddToGitignoreResponse":
        return cls(
            success=bool(data["success"]),
            message=str(data["message"]),
        )


AbstraLibApiEditorEnvVarsListResponseItem = AbstraLibApiEditorEnvVarsModel

AbstraLibApiEditorEnvVarsListResponse = typing.List[
    AbstraLibApiEditorEnvVarsListResponseItem
]

AbstraLibApiEditorEnvVarsCreateRequest = AbstraLibApiEditorEnvVarsModel

AbstraLibApiEditorEnvVarsCreateResponse = AbstraLibApiEditorEnvVarsModel

AbstraLibApiEditorLintersFixResponseSuccess = bool


@dataclass
class AbstraLibApiEditorLintersFixResponse:
    success: AbstraLibApiEditorLintersFixResponseSuccess

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorLintersFixResponse":
        return cls(
            success=bool(data["success"]),
        )


AbstraLibApiEditorLintersCheckResponseItem = AbstraLibApiEditorLintersRule

AbstraLibApiEditorLintersCheckResponse = typing.List[
    AbstraLibApiEditorLintersCheckResponseItem
]

AbstraLibApiEditorCodebaseTypeCheckPostResponseSuccess = bool

AbstraLibApiEditorCodebaseTypeCheckPostResponseStdout = str

AbstraLibApiEditorCodebaseTypeCheckPostResponseStderr = str


@dataclass
class AbstraLibApiEditorCodebaseTypeCheckPostResponse:
    success: AbstraLibApiEditorCodebaseTypeCheckPostResponseSuccess
    stdout: AbstraLibApiEditorCodebaseTypeCheckPostResponseStdout
    stderr: AbstraLibApiEditorCodebaseTypeCheckPostResponseStderr

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        data["stdout"] = self.stdout
        data["stderr"] = self.stderr
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseTypeCheckPostResponse":
        return cls(
            success=bool(data["success"]),
            stdout=str(data["stdout"]),
            stderr=str(data["stderr"]),
        )


AbstraLibApiEditorCodebaseFilesPostResponse = CommonFileNode

AbstraLibApiEditorCodebaseFilesDeleteResponseOk = bool


@dataclass
class AbstraLibApiEditorCodebaseFilesDeleteResponse:
    ok: AbstraLibApiEditorCodebaseFilesDeleteResponseOk

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["ok"] = self.ok
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesDeleteResponse":
        return cls(
            ok=bool(data["ok"]),
        )


AbstraLibApiEditorCodebaseFilesPutRequestContent = str


@dataclass
class AbstraLibApiEditorCodebaseFilesPutRequest:
    content: AbstraLibApiEditorCodebaseFilesPutRequestContent

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["content"] = self.content
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesPutRequest":
        return cls(
            content=str(data["content"]),
        )


AbstraLibApiEditorCodebaseFilesPutResponseOk = bool


@dataclass
class AbstraLibApiEditorCodebaseFilesPutResponse:
    ok: AbstraLibApiEditorCodebaseFilesPutResponseOk

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["ok"] = self.ok
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesPutResponse":
        return cls(
            ok=bool(data["ok"]),
        )


AbstraLibApiEditorCodebaseFilesGetRequestPath = str

AbstraLibApiEditorCodebaseFilesGetRequestMode = typing.Union[
    typing.Literal["file"],
    typing.Literal["image"],
    typing.Literal["python-file"],
    typing.Literal["module"],
]

AbstraLibApiEditorCodebaseFilesGetRequestModeValues: typing.List[
    AbstraLibApiEditorCodebaseFilesGetRequestMode
] = ["file", "image", "python-file", "module"]


@dataclass
class AbstraLibApiEditorCodebaseFilesGetRequest:
    path: typing.Optional[AbstraLibApiEditorCodebaseFilesGetRequestPath] = field(
        default_factory=lambda: None
    )
    mode: typing.Optional[AbstraLibApiEditorCodebaseFilesGetRequestMode] = field(
        default_factory=lambda: "file"
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.path is not None:
            data["path"] = self.path
        if self.mode is not None:
            data["mode"] = self.mode
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesGetRequest":
        return cls(
            path=None if data.get("path") is None else str(data["path"]),
            mode=data.get("mode", "file"),
        )


AbstraLibApiEditorCodebaseFilesGetResponseItemFile = CommonFileNode

AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemType = typing.Union[
    typing.Literal["form"],
    typing.Literal["hook"],
    typing.Literal["job"],
    typing.Literal["script"],
    typing.Literal["page"],
]

AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemTypeValues: typing.List[
    AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemType
] = ["form", "hook", "job", "script", "page"]

AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemId = str


@dataclass
class AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItem:
    type: AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemType
    id: AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItemId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["id"] = self.id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItem":
        return cls(
            type=data["type"],
            id=str(data["id"]),
        )


AbstraLibApiEditorCodebaseFilesGetResponseItemStages = typing.List[
    AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItem
]


@dataclass
class AbstraLibApiEditorCodebaseFilesGetResponseItem:
    file: AbstraLibApiEditorCodebaseFilesGetResponseItemFile
    stages: AbstraLibApiEditorCodebaseFilesGetResponseItemStages

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["file"] = self.file.to_dict()
        data["stages"] = [item.to_dict() for item in self.stages]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesGetResponseItem":
        return cls(
            file=CommonFileNode.from_dict(data["file"]),
            stages=[
                AbstraLibApiEditorCodebaseFilesGetResponseItemStagesItem.from_dict(item)
                for item in data["stages"]
            ],
        )


AbstraLibApiEditorCodebaseFilesGetResponse = typing.List[
    AbstraLibApiEditorCodebaseFilesGetResponseItem
]

AbstraLibApiEditorCodebaseFilesPatchRequestPathPartsItem = str

AbstraLibApiEditorCodebaseFilesPatchRequestPathParts = typing.List[
    AbstraLibApiEditorCodebaseFilesPatchRequestPathPartsItem
]

AbstraLibApiEditorCodebaseFilesPatchRequestNewPathPartsItem = str

AbstraLibApiEditorCodebaseFilesPatchRequestNewPathParts = typing.List[
    AbstraLibApiEditorCodebaseFilesPatchRequestNewPathPartsItem
]


@dataclass
class AbstraLibApiEditorCodebaseFilesPatchRequest:
    path_parts: AbstraLibApiEditorCodebaseFilesPatchRequestPathParts
    new_path_parts: AbstraLibApiEditorCodebaseFilesPatchRequestNewPathParts

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["pathParts"] = self.path_parts
        data["newPathParts"] = self.new_path_parts
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesPatchRequest":
        return cls(
            path_parts=[str(item) for item in data["pathParts"]],
            new_path_parts=[str(item) for item in data["newPathParts"]],
        )


AbstraLibApiEditorCodebaseFilesPatchResponseOk = bool


@dataclass
class AbstraLibApiEditorCodebaseFilesPatchResponse:
    ok: AbstraLibApiEditorCodebaseFilesPatchResponseOk

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["ok"] = self.ok
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseFilesPatchResponse":
        return cls(
            ok=bool(data["ok"]),
        )


AbstraLibApiEditorCodebaseDirPostResponseOk = bool


@dataclass
class AbstraLibApiEditorCodebaseDirPostResponse:
    ok: AbstraLibApiEditorCodebaseDirPostResponseOk

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["ok"] = self.ok
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseDirPostResponse":
        return cls(
            ok=bool(data["ok"]),
        )


AbstraLibApiEditorCodebaseCheckFilesPostRequestPathsItem = str

AbstraLibApiEditorCodebaseCheckFilesPostRequestPaths = typing.List[
    AbstraLibApiEditorCodebaseCheckFilesPostRequestPathsItem
]


@dataclass
class AbstraLibApiEditorCodebaseCheckFilesPostRequest:
    paths: AbstraLibApiEditorCodebaseCheckFilesPostRequestPaths

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["paths"] = self.paths
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseCheckFilesPostRequest":
        return cls(
            paths=[str(item) for item in data["paths"]],
        )


AbstraLibApiEditorCodebaseCheckFilesPostResponseAdditionalProperty = bool

AbstraLibApiEditorCodebaseCheckFilesPostResponse = typing.Dict[str, bool]

AbstraLibApiEditorCodebaseInitFilePostRequestPath = str

AbstraLibApiEditorCodebaseInitFilePostRequestType = typing.Union[
    typing.Literal["scripts"],
    typing.Literal["forms"],
    typing.Literal["hooks"],
    typing.Literal["jobs"],
]

AbstraLibApiEditorCodebaseInitFilePostRequestTypeValues: typing.List[
    AbstraLibApiEditorCodebaseInitFilePostRequestType
] = ["scripts", "forms", "hooks", "jobs"]


@dataclass
class AbstraLibApiEditorCodebaseInitFilePostRequest:
    path: AbstraLibApiEditorCodebaseInitFilePostRequestPath
    type: AbstraLibApiEditorCodebaseInitFilePostRequestType

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["path"] = self.path
        data["type"] = self.type
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseInitFilePostRequest":
        return cls(
            path=str(data["path"]),
            type=data["type"],
        )


AbstraLibApiEditorCodebaseInitFilePostResponseSuccess = bool


@dataclass
class AbstraLibApiEditorCodebaseInitFilePostResponse:
    success: AbstraLibApiEditorCodebaseInitFilePostResponseSuccess

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseInitFilePostResponse":
        return cls(
            success=bool(data["success"]),
        )


AbstraLibApiEditorCodebaseCheckFileGetResponseExists = bool


@dataclass
class AbstraLibApiEditorCodebaseCheckFileGetResponse:
    exists: AbstraLibApiEditorCodebaseCheckFileGetResponseExists

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["exists"] = self.exists
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseCheckFileGetResponse":
        return cls(
            exists=bool(data["exists"]),
        )


AbstraLibApiEditorCodebaseSettingsGetResponseSeparator = str


@dataclass
class AbstraLibApiEditorCodebaseSettingsGetResponse:
    separator: AbstraLibApiEditorCodebaseSettingsGetResponseSeparator

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["separator"] = self.separator
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorCodebaseSettingsGetResponse":
        return cls(
            separator=str(data["separator"]),
        )


AbstraLibApiEditorHooksPostRequestTitle = str

AbstraLibApiEditorHooksPostRequestFile = str

AbstraLibApiEditorHooksPostRequestId = str

AbstraLibApiEditorHooksPostRequestPositionItem = float

AbstraLibApiEditorHooksPostRequestPosition = typing.List[
    AbstraLibApiEditorHooksPostRequestPositionItem
]


@dataclass
class AbstraLibApiEditorHooksPostRequest:
    title: AbstraLibApiEditorHooksPostRequestTitle
    file: AbstraLibApiEditorHooksPostRequestFile
    id: typing.Optional[AbstraLibApiEditorHooksPostRequestId] = field(
        default_factory=lambda: None
    )
    position: typing.Optional[AbstraLibApiEditorHooksPostRequestPosition] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["title"] = self.title
        data["file"] = self.file
        if self.id is not None:
            data["id"] = self.id
        if self.position is not None:
            data["position"] = self.position
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorHooksPostRequest":
        return cls(
            title=str(data["title"]),
            file=str(data["file"]),
            id=None if data.get("id") is None else str(data["id"]),
            position=None
            if data.get("position") is None
            else [float(item) for item in data["position"]],
        )


AbstraLibApiEditorHooksPostResponse = AbstraLibApiStage

AbstraLibApiEditorHooksDeleteResponseSuccess = bool


@dataclass
class AbstraLibApiEditorHooksDeleteResponse:
    success: AbstraLibApiEditorHooksDeleteResponseSuccess

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorHooksDeleteResponse":
        return cls(
            success=bool(data["success"]),
        )


AbstraLibApiEditorHooksPutRequestTitle = str

AbstraLibApiEditorHooksPutRequestFile = str

AbstraLibApiEditorHooksPutRequestPath = str

AbstraLibApiEditorHooksPutRequestPositionItem = float

AbstraLibApiEditorHooksPutRequestPosition = typing.List[
    AbstraLibApiEditorHooksPutRequestPositionItem
]


@dataclass
class AbstraLibApiEditorHooksPutRequest:
    title: typing.Optional[AbstraLibApiEditorHooksPutRequestTitle] = field(
        default_factory=lambda: None
    )
    file: typing.Optional[AbstraLibApiEditorHooksPutRequestFile] = field(
        default_factory=lambda: None
    )
    path: typing.Optional[AbstraLibApiEditorHooksPutRequestPath] = field(
        default_factory=lambda: None
    )
    position: typing.Optional[AbstraLibApiEditorHooksPutRequestPosition] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.title is not None:
            data["title"] = self.title
        if self.file is not None:
            data["file"] = self.file
        if self.path is not None:
            data["path"] = self.path
        if self.position is not None:
            data["position"] = self.position
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorHooksPutRequest":
        return cls(
            title=None if data.get("title") is None else str(data["title"]),
            file=None if data.get("file") is None else str(data["file"]),
            path=None if data.get("path") is None else str(data["path"]),
            position=None
            if data.get("position") is None
            else [float(item) for item in data["position"]],
        )


AbstraLibApiEditorHooksPutResponse = AbstraLibApiStage

AbstraLibApiEditorHooksGetResponseItem = AbstraLibApiStage

AbstraLibApiEditorHooksGetResponse = typing.List[AbstraLibApiEditorHooksGetResponseItem]

AbstraLibApiEditorWorkspaceVersionGetResponseVersion = str


@dataclass
class AbstraLibApiEditorWorkspaceVersionGetResponse:
    version: AbstraLibApiEditorWorkspaceVersionGetResponseVersion

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["version"] = self.version
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorWorkspaceVersionGetResponse":
        return cls(
            version=str(data["version"]),
        )


AbstraLibApiEditorWorkspaceTestDataPostRequestTestData = str


@dataclass
class AbstraLibApiEditorWorkspaceTestDataPostRequest:
    test_data: AbstraLibApiEditorWorkspaceTestDataPostRequestTestData

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["test_data"] = self.test_data
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorWorkspaceTestDataPostRequest":
        return cls(
            test_data=str(data["test_data"]),
        )


AbstraLibApiEditorWorkspaceTestDataPostResponseSuccess = bool


@dataclass
class AbstraLibApiEditorWorkspaceTestDataPostResponse:
    success: AbstraLibApiEditorWorkspaceTestDataPostResponseSuccess

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorWorkspaceTestDataPostResponse":
        return cls(
            success=bool(data["success"]),
        )


AbstraLibApiEditorWorkspaceTestDataGetResponse = str

AbstraLibApiEditorDeployPostRequestStrategy = typing.Union[
    typing.Literal["direct"], typing.Literal["git"]
]

AbstraLibApiEditorDeployPostRequestStrategyValues: typing.List[
    AbstraLibApiEditorDeployPostRequestStrategy
] = ["direct", "git"]

AbstraLibApiEditorDeployPostRequestBranch = str


@dataclass
class AbstraLibApiEditorDeployPostRequest:
    strategy: typing.Optional[AbstraLibApiEditorDeployPostRequestStrategy] = field(
        default_factory=lambda: "git"
    )
    branch: typing.Optional[AbstraLibApiEditorDeployPostRequestBranch] = field(
        default_factory=lambda: "main"
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        if self.strategy is not None:
            data["strategy"] = self.strategy
        if self.branch is not None:
            data["branch"] = self.branch
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorDeployPostRequest":
        return cls(
            strategy=data.get("strategy", "git"),
            branch=data.get("branch", "main"),
        )


AbstraLibApiEditorDeployPostResponseSuccess = bool

AbstraLibApiEditorDeployPostResponseMessage = str


@dataclass
class AbstraLibApiEditorDeployPostResponse:
    success: AbstraLibApiEditorDeployPostResponseSuccess
    message: typing.Optional[AbstraLibApiEditorDeployPostResponseMessage] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["success"] = self.success
        if self.message is not None:
            data["message"] = self.message
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorDeployPostResponse":
        return cls(
            success=bool(data["success"]),
            message=None if data.get("message") is None else str(data["message"]),
        )


AbstraLibApiEditorConnectorsSchemaResponseItemMetadataKey = str

AbstraLibApiEditorConnectorsSchemaResponseItemMetadataLabel = str

AbstraLibApiEditorConnectorsSchemaResponseItemMetadataLogoUrl = str


@dataclass
class AbstraLibApiEditorConnectorsSchemaResponseItemMetadata:
    key: AbstraLibApiEditorConnectorsSchemaResponseItemMetadataKey
    label: AbstraLibApiEditorConnectorsSchemaResponseItemMetadataLabel
    logo_url: AbstraLibApiEditorConnectorsSchemaResponseItemMetadataLogoUrl

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        data["label"] = self.label
        data["logoUrl"] = self.logo_url
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorConnectorsSchemaResponseItemMetadata":
        return cls(
            key=str(data["key"]),
            label=str(data["label"]),
            logo_url=str(data["logoUrl"]),
        )


AbstraLibApiEditorConnectorsSchemaResponseItemActionsItemKey = str

AbstraLibApiEditorConnectorsSchemaResponseItemActionsItemDescription = str


@dataclass
class AbstraLibApiEditorConnectorsSchemaResponseItemActionsItem:
    key: AbstraLibApiEditorConnectorsSchemaResponseItemActionsItemKey
    description: typing.Optional[
        AbstraLibApiEditorConnectorsSchemaResponseItemActionsItemDescription
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["key"] = self.key
        if self.description is not None:
            data["description"] = self.description
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorConnectorsSchemaResponseItemActionsItem":
        return cls(
            key=str(data["key"]),
            description=None
            if data.get("description") is None
            else str(data["description"]),
        )


AbstraLibApiEditorConnectorsSchemaResponseItemActions = typing.List[
    AbstraLibApiEditorConnectorsSchemaResponseItemActionsItem
]


@dataclass
class AbstraLibApiEditorConnectorsSchemaResponseItem:
    metadata: AbstraLibApiEditorConnectorsSchemaResponseItemMetadata
    actions: typing.Optional[AbstraLibApiEditorConnectorsSchemaResponseItemActions] = (
        field(default_factory=lambda: None)
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["metadata"] = self.metadata.to_dict()
        if self.actions is not None:
            data["actions"] = [item.to_dict() for item in self.actions]
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiEditorConnectorsSchemaResponseItem":
        return cls(
            metadata=AbstraLibApiEditorConnectorsSchemaResponseItemMetadata.from_dict(
                data["metadata"]
            ),
            actions=None
            if data.get("actions") is None
            else [
                AbstraLibApiEditorConnectorsSchemaResponseItemActionsItem.from_dict(
                    item
                )
                for item in data["actions"]
            ],
        )


AbstraLibApiEditorConnectorsSchemaResponse = typing.List[
    AbstraLibApiEditorConnectorsSchemaResponseItem
]

AbstraLibApiEditorConnectorsConnectionsResponse = (
    CloudApiCliConnectorsConnectionsResponse
)

AbstraLibApiAiStreamRequestConversationId = CloudApiCliAiV2StreamRequestConversationId

AbstraLibApiAiStreamRequestContent = CloudApiCliAiV2StreamRequestContent

AbstraLibApiAiStreamRequestContext = typing.Dict[str, typing.Any]

AbstraLibApiAiStreamRequestHumanApproval = str

AbstraLibApiAiStreamRequestToolCallsApproval = (
    CloudApiCliAiV2StreamRequestToolCallsApproval
)

AbstraLibApiAiStreamRequestBrowserToolsItem = CloudApiConsoleBrowserToolsDefinition

AbstraLibApiAiStreamRequestBrowserTools = typing.List[
    AbstraLibApiAiStreamRequestBrowserToolsItem
]

AbstraLibApiAiStreamRequestBrowserToolResponsesItem = (
    CloudApiConsoleBrowserToolsResponse
)

AbstraLibApiAiStreamRequestBrowserToolResponses = typing.List[
    AbstraLibApiAiStreamRequestBrowserToolResponsesItem
]

AbstraLibApiAiStreamRequestAutoApproveToolCalls = (
    CloudApiCliAiV2StreamRequestAutoApproveToolCalls
)


@dataclass
class AbstraLibApiAiStreamRequest:
    conversation_id: AbstraLibApiAiStreamRequestConversationId
    content: AbstraLibApiAiStreamRequestContent
    context: AbstraLibApiAiStreamRequestContext
    human_approval: typing.Optional[AbstraLibApiAiStreamRequestHumanApproval] = field(
        default_factory=lambda: None
    )
    tool_calls_approval: typing.Optional[
        AbstraLibApiAiStreamRequestToolCallsApproval
    ] = field(default_factory=lambda: None)
    browser_tools: typing.Optional[AbstraLibApiAiStreamRequestBrowserTools] = field(
        default_factory=lambda: None
    )
    browser_tool_responses: typing.Optional[
        AbstraLibApiAiStreamRequestBrowserToolResponses
    ] = field(default_factory=lambda: None)
    auto_approve_tool_calls: typing.Optional[
        AbstraLibApiAiStreamRequestAutoApproveToolCalls
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["conversationId"] = self.conversation_id
        data["content"] = [item.to_dict() for item in self.content]
        data["context"] = self.context
        if self.human_approval is not None:
            data["humanApproval"] = self.human_approval
        if self.tool_calls_approval is not None:
            data["toolCallsApproval"] = self.tool_calls_approval.to_dict()
        if self.browser_tools is not None:
            data["browserTools"] = [item.to_dict() for item in self.browser_tools]
        if self.browser_tool_responses is not None:
            data["browserToolResponses"] = [
                item.to_dict() for item in self.browser_tool_responses
            ]
        if self.auto_approve_tool_calls is not None:
            data["autoApproveToolCalls"] = self.auto_approve_tool_calls
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "AbstraLibApiAiStreamRequest":
        return cls(
            conversation_id=str(data["conversationId"]),
            content=[
                (
                    CloudApiCliAiV2StreamRequestContentItemAssistantTextInput.from_dict(
                        item
                    )
                    if isinstance(item, dict) and (item.get("type", None) == "text")
                    else CloudApiCliAiV2StreamRequestContentItemAssistantFileInput.from_dict(
                        item
                    )
                )
                for item in data["content"]
            ],
            context=dict(**data["context"]),
            human_approval=None
            if data.get("humanApproval") is None
            else str(data["humanApproval"]),
            tool_calls_approval=None
            if data.get("toolCallsApproval") is None
            else CloudApiCliAiV2StreamRequestToolCallsApproval.from_dict(
                data["toolCallsApproval"]
            ),
            browser_tools=None
            if data.get("browserTools") is None
            else [
                CloudApiConsoleBrowserToolsDefinition.from_dict(item)
                for item in data["browserTools"]
            ],
            browser_tool_responses=None
            if data.get("browserToolResponses") is None
            else [
                CloudApiConsoleBrowserToolsResponse.from_dict(item)
                for item in data["browserToolResponses"]
            ],
            auto_approve_tool_calls=None
            if data.get("autoApproveToolCalls") is None
            else bool(data["autoApproveToolCalls"]),
        )


RabbitDispatchExecutionId = str

RabbitDispatchExecutionKey = str

RabbitDispatchJobKey = str

RabbitDispatchJobId = str

RabbitDispatchProjectId = str

RabbitDispatchScheduledTime = datetime.datetime

RabbitDispatchPublishedAt = datetime.datetime

RabbitDispatchPayload = typing.Dict[str, typing.Any]

RabbitDispatchMetaAttempt = int

RabbitDispatchMetaSource = str


@dataclass
class RabbitDispatchMeta:
    attempt: RabbitDispatchMetaAttempt
    source: RabbitDispatchMetaSource

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["attempt"] = self.attempt
        data["source"] = self.source
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "RabbitDispatchMeta":
        return cls(
            attempt=int(data["attempt"]),
            source=str(data["source"]),
        )


@dataclass
class RabbitDispatch:
    execution_id: RabbitDispatchExecutionId
    execution_key: RabbitDispatchExecutionKey
    job_key: RabbitDispatchJobKey
    job_id: RabbitDispatchJobId
    project_id: RabbitDispatchProjectId
    scheduled_time: RabbitDispatchScheduledTime
    published_at: RabbitDispatchPublishedAt
    payload: RabbitDispatchPayload
    meta: RabbitDispatchMeta

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["execution_id"] = self.execution_id
        data["execution_key"] = self.execution_key
        data["job_key"] = self.job_key
        data["job_id"] = self.job_id
        data["project_id"] = self.project_id
        data["scheduled_time"] = self.scheduled_time.isoformat()
        data["published_at"] = self.published_at.isoformat()
        data["payload"] = self.payload
        data["meta"] = self.meta.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "RabbitDispatch":
        return cls(
            execution_id=str(data["execution_id"]),
            execution_key=str(data["execution_key"]),
            job_key=str(data["job_key"]),
            job_id=str(data["job_id"]),
            project_id=str(data["project_id"]),
            scheduled_time=datetime.datetime.fromisoformat(data["scheduled_time"]),
            published_at=datetime.datetime.fromisoformat(data["published_at"]),
            payload=dict(**data["payload"]),
            meta=RabbitDispatchMeta.from_dict(data["meta"]),
        )


RabbitControlStopMessageType = typing.Literal["stop"]

RabbitControlStopMessageTypeValues: typing.List[RabbitControlStopMessageType] = ["stop"]

RabbitControlStopMessagePayloadExecutionId = str


@dataclass
class RabbitControlStopMessagePayload:
    execution_id: RabbitControlStopMessagePayloadExecutionId

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["execution_id"] = self.execution_id
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitControlStopMessagePayload":
        return cls(
            execution_id=str(data["execution_id"]),
        )


@dataclass
class RabbitControlStopMessage:
    type: RabbitControlStopMessageType
    payload: RabbitControlStopMessagePayload

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["payload"] = self.payload.to_dict()
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitControlStopMessage":
        return cls(
            type=data["type"],
            payload=RabbitControlStopMessagePayload.from_dict(data["payload"]),
        )


RabbitControlPingMessageType = typing.Literal["ping"]

RabbitControlPingMessageTypeValues: typing.List[RabbitControlPingMessageType] = ["ping"]

RabbitControlPingMessagePayload = typing.Dict[str, typing.Any]


@dataclass
class RabbitControlPingMessage:
    type: RabbitControlPingMessageType
    payload: RabbitControlPingMessagePayload

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["type"] = self.type
        data["payload"] = self.payload
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitControlPingMessage":
        return cls(
            type=data["type"],
            payload=dict(**data["payload"]),
        )


RabbitControl = typing.Union[RabbitControlStopMessage, RabbitControlPingMessage]


def rabbit_control_from_dict(data: typing.Any) -> "RabbitControl":
    if isinstance(data, dict) and (data.get("type", None) == "stop"):
        return RabbitControlStopMessage.from_dict(data)
    if isinstance(data, dict) and (data.get("type", None) == "ping"):
        return RabbitControlPingMessage.from_dict(data)
    raise ValueError(f"Could not parse RabbitControl from dict: {data}")


RabbitRunDeliveryTag = int

RabbitRunExecutionStageId = str

RabbitRunExecutionExecutionId = str

RabbitRunExecutionSendQueue = str

RabbitRunExecutionRecvQueue = str

RabbitRunExecutionQueueExpireMs = int

RabbitRunExecutionContextJobContextExecutionType = typing.Literal["job"]

RabbitRunExecutionContextJobContextExecutionTypeValues: typing.List[
    RabbitRunExecutionContextJobContextExecutionType
] = ["job"]

RabbitRunExecutionContextJobContextSentTasksItem = str

RabbitRunExecutionContextJobContextSentTasks = typing.List[
    RabbitRunExecutionContextJobContextSentTasksItem
]

RabbitRunExecutionContextJobContextLegacyThreadData = typing.Dict[str, typing.Any]

RabbitRunExecutionContextJobContextMockExecution = typing.Dict[str, typing.Any]


@dataclass
class RabbitRunExecutionContextJobContext:
    execution_type: RabbitRunExecutionContextJobContextExecutionType
    sent_tasks: typing.Optional[RabbitRunExecutionContextJobContextSentTasks] = field(
        default_factory=lambda: None
    )
    legacy_thread_data: typing.Optional[
        RabbitRunExecutionContextJobContextLegacyThreadData
    ] = field(default_factory=lambda: None)
    mock_execution: typing.Optional[
        RabbitRunExecutionContextJobContextMockExecution
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["executionType"] = self.execution_type
        if self.sent_tasks is not None:
            data["sent_tasks"] = self.sent_tasks
        if self.legacy_thread_data is not None:
            data["legacy_thread_data"] = self.legacy_thread_data
        if self.mock_execution is not None:
            data["mock_execution"] = self.mock_execution
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunExecutionContextJobContext":
        return cls(
            execution_type=data["executionType"],
            sent_tasks=None
            if data.get("sent_tasks") is None
            else [str(item) for item in data["sent_tasks"]],
            legacy_thread_data=None
            if data.get("legacy_thread_data") is None
            else dict(**data["legacy_thread_data"]),
            mock_execution=None
            if data.get("mock_execution") is None
            else dict(**data["mock_execution"]),
        )


RabbitRunExecutionContextTaskletContextExecutionType = typing.Literal["tasklet"]

RabbitRunExecutionContextTaskletContextExecutionTypeValues: typing.List[
    RabbitRunExecutionContextTaskletContextExecutionType
] = ["tasklet"]

RabbitRunExecutionContextTaskletContextTaskId = str

RabbitRunExecutionContextTaskletContextSentTasksItem = str

RabbitRunExecutionContextTaskletContextSentTasks = typing.List[
    RabbitRunExecutionContextTaskletContextSentTasksItem
]

RabbitRunExecutionContextTaskletContextLegacyThreadData = typing.Dict[str, typing.Any]

RabbitRunExecutionContextTaskletContextMockExecution = typing.Dict[str, typing.Any]


@dataclass
class RabbitRunExecutionContextTaskletContext:
    execution_type: RabbitRunExecutionContextTaskletContextExecutionType
    task_id: RabbitRunExecutionContextTaskletContextTaskId
    sent_tasks: typing.Optional[RabbitRunExecutionContextTaskletContextSentTasks] = (
        field(default_factory=lambda: None)
    )
    legacy_thread_data: typing.Optional[
        RabbitRunExecutionContextTaskletContextLegacyThreadData
    ] = field(default_factory=lambda: None)
    mock_execution: typing.Optional[
        RabbitRunExecutionContextTaskletContextMockExecution
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["executionType"] = self.execution_type
        data["task_id"] = self.task_id
        if self.sent_tasks is not None:
            data["sent_tasks"] = self.sent_tasks
        if self.legacy_thread_data is not None:
            data["legacy_thread_data"] = self.legacy_thread_data
        if self.mock_execution is not None:
            data["mock_execution"] = self.mock_execution
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunExecutionContextTaskletContext":
        return cls(
            execution_type=data["executionType"],
            task_id=str(data["task_id"]),
            sent_tasks=None
            if data.get("sent_tasks") is None
            else [str(item) for item in data["sent_tasks"]],
            legacy_thread_data=None
            if data.get("legacy_thread_data") is None
            else dict(**data["legacy_thread_data"]),
            mock_execution=None
            if data.get("mock_execution") is None
            else dict(**data["mock_execution"]),
        )


RabbitRunExecutionContextFormContextExecutionType = typing.Literal["form"]

RabbitRunExecutionContextFormContextExecutionTypeValues: typing.List[
    RabbitRunExecutionContextFormContextExecutionType
] = ["form"]

RabbitRunDefinitionsRequestQueryParamsAdditionalProperty = str

RabbitRunDefinitionsRequestQueryParams = typing.Dict[str, str]

RabbitRunDefinitionsRequestHeadersAdditionalProperty = str

RabbitRunDefinitionsRequestHeaders = typing.Dict[str, str]

RabbitRunDefinitionsRequestMethod = str

RabbitRunDefinitionsRequestBody = str


@dataclass
class RabbitRunDefinitionsRequest:
    query_params: RabbitRunDefinitionsRequestQueryParams
    headers: RabbitRunDefinitionsRequestHeaders
    method: RabbitRunDefinitionsRequestMethod
    body: RabbitRunDefinitionsRequestBody

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["query_params"] = self.query_params
        data["headers"] = self.headers
        data["method"] = self.method
        data["body"] = self.body
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunDefinitionsRequest":
        return cls(
            query_params=dict(**data["query_params"]),
            headers=dict(**data["headers"]),
            method=str(data["method"]),
            body=str(data["body"]),
        )


RabbitRunExecutionContextFormContextRequest = RabbitRunDefinitionsRequest

RabbitRunExecutionContextFormContextSentTasksItem = str

RabbitRunExecutionContextFormContextSentTasks = typing.List[
    RabbitRunExecutionContextFormContextSentTasksItem
]

RabbitRunExecutionContextFormContextLegacyThreadData = typing.Dict[str, typing.Any]

RabbitRunExecutionContextFormContextMockExecution = typing.Dict[str, typing.Any]


@dataclass
class RabbitRunExecutionContextFormContext:
    execution_type: RabbitRunExecutionContextFormContextExecutionType
    request: RabbitRunExecutionContextFormContextRequest
    sent_tasks: typing.Optional[RabbitRunExecutionContextFormContextSentTasks] = field(
        default_factory=lambda: None
    )
    legacy_thread_data: typing.Optional[
        RabbitRunExecutionContextFormContextLegacyThreadData
    ] = field(default_factory=lambda: None)
    mock_execution: typing.Optional[
        RabbitRunExecutionContextFormContextMockExecution
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["executionType"] = self.execution_type
        data["request"] = self.request.to_dict()
        if self.sent_tasks is not None:
            data["sent_tasks"] = self.sent_tasks
        if self.legacy_thread_data is not None:
            data["legacy_thread_data"] = self.legacy_thread_data
        if self.mock_execution is not None:
            data["mock_execution"] = self.mock_execution
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunExecutionContextFormContext":
        return cls(
            execution_type=data["executionType"],
            request=RabbitRunDefinitionsRequest.from_dict(data["request"]),
            sent_tasks=None
            if data.get("sent_tasks") is None
            else [str(item) for item in data["sent_tasks"]],
            legacy_thread_data=None
            if data.get("legacy_thread_data") is None
            else dict(**data["legacy_thread_data"]),
            mock_execution=None
            if data.get("mock_execution") is None
            else dict(**data["mock_execution"]),
        )


RabbitRunExecutionContextHookContextExecutionType = typing.Literal["hook"]

RabbitRunExecutionContextHookContextExecutionTypeValues: typing.List[
    RabbitRunExecutionContextHookContextExecutionType
] = ["hook"]

RabbitRunExecutionContextHookContextRequest = RabbitRunDefinitionsRequest

RabbitRunDefinitionsResponseHeadersAdditionalProperty = str

RabbitRunDefinitionsResponseHeaders = typing.Dict[str, str]

RabbitRunDefinitionsResponseStatus = int

RabbitRunDefinitionsResponseBody = str


@dataclass
class RabbitRunDefinitionsResponse:
    headers: RabbitRunDefinitionsResponseHeaders
    status: RabbitRunDefinitionsResponseStatus
    body: RabbitRunDefinitionsResponseBody

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["headers"] = self.headers
        data["status"] = self.status
        data["body"] = self.body
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunDefinitionsResponse":
        return cls(
            headers=dict(**data["headers"]),
            status=int(data["status"]),
            body=str(data["body"]),
        )


RabbitRunExecutionContextHookContextResponse = RabbitRunDefinitionsResponse

RabbitRunExecutionContextHookContextSentTasksItem = str

RabbitRunExecutionContextHookContextSentTasks = typing.List[
    RabbitRunExecutionContextHookContextSentTasksItem
]

RabbitRunExecutionContextHookContextLegacyThreadData = typing.Dict[str, typing.Any]

RabbitRunExecutionContextHookContextMockExecution = typing.Dict[str, typing.Any]


@dataclass
class RabbitRunExecutionContextHookContext:
    execution_type: RabbitRunExecutionContextHookContextExecutionType
    request: RabbitRunExecutionContextHookContextRequest
    response: RabbitRunExecutionContextHookContextResponse
    sent_tasks: typing.Optional[RabbitRunExecutionContextHookContextSentTasks] = field(
        default_factory=lambda: None
    )
    legacy_thread_data: typing.Optional[
        RabbitRunExecutionContextHookContextLegacyThreadData
    ] = field(default_factory=lambda: None)
    mock_execution: typing.Optional[
        RabbitRunExecutionContextHookContextMockExecution
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["executionType"] = self.execution_type
        data["request"] = self.request.to_dict()
        data["response"] = self.response.to_dict()
        if self.sent_tasks is not None:
            data["sent_tasks"] = self.sent_tasks
        if self.legacy_thread_data is not None:
            data["legacy_thread_data"] = self.legacy_thread_data
        if self.mock_execution is not None:
            data["mock_execution"] = self.mock_execution
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunExecutionContextHookContext":
        return cls(
            execution_type=data["executionType"],
            request=RabbitRunDefinitionsRequest.from_dict(data["request"]),
            response=RabbitRunDefinitionsResponse.from_dict(data["response"]),
            sent_tasks=None
            if data.get("sent_tasks") is None
            else [str(item) for item in data["sent_tasks"]],
            legacy_thread_data=None
            if data.get("legacy_thread_data") is None
            else dict(**data["legacy_thread_data"]),
            mock_execution=None
            if data.get("mock_execution") is None
            else dict(**data["mock_execution"]),
        )


RabbitRunExecutionContextCodeSnippetContextExecutionType = typing.Literal[
    "code-snippet"
]

RabbitRunExecutionContextCodeSnippetContextExecutionTypeValues: typing.List[
    RabbitRunExecutionContextCodeSnippetContextExecutionType
] = ["code-snippet"]

RabbitRunExecutionContextCodeSnippetContextMockExecution = typing.Dict[str, typing.Any]


@dataclass
class RabbitRunExecutionContextCodeSnippetContext:
    execution_type: RabbitRunExecutionContextCodeSnippetContextExecutionType
    mock_execution: typing.Optional[
        RabbitRunExecutionContextCodeSnippetContextMockExecution
    ] = field(default_factory=lambda: None)

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["executionType"] = self.execution_type
        if self.mock_execution is not None:
            data["mock_execution"] = self.mock_execution
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitRunExecutionContextCodeSnippetContext":
        return cls(
            execution_type=data["executionType"],
            mock_execution=None
            if data.get("mock_execution") is None
            else dict(**data["mock_execution"]),
        )


RabbitRunExecutionContext = typing.Union[
    RabbitRunExecutionContextJobContext,
    RabbitRunExecutionContextTaskletContext,
    RabbitRunExecutionContextFormContext,
    RabbitRunExecutionContextHookContext,
    RabbitRunExecutionContextCodeSnippetContext,
]


def rabbit_run_execution_context_from_dict(
    data: typing.Any,
) -> "RabbitRunExecutionContext":
    if isinstance(data, dict) and "executionType" in data:
        if data["executionType"] == "job":
            return RabbitRunExecutionContextJobContext.from_dict(data)
        if data["executionType"] == "tasklet":
            return RabbitRunExecutionContextTaskletContext.from_dict(data)
        if data["executionType"] == "form":
            return RabbitRunExecutionContextFormContext.from_dict(data)
        if data["executionType"] == "hook":
            return RabbitRunExecutionContextHookContext.from_dict(data)
        if data["executionType"] == "code-snippet":
            return RabbitRunExecutionContextCodeSnippetContext.from_dict(data)
    if isinstance(data, dict) and (data.get("executionType", None) == "job"):
        return RabbitRunExecutionContextJobContext.from_dict(data)
    if isinstance(data, dict) and (data.get("executionType", None) == "tasklet"):
        return RabbitRunExecutionContextTaskletContext.from_dict(data)
    if isinstance(data, dict) and (data.get("executionType", None) == "form"):
        return RabbitRunExecutionContextFormContext.from_dict(data)
    if isinstance(data, dict) and (data.get("executionType", None) == "hook"):
        return RabbitRunExecutionContextHookContext.from_dict(data)
    if isinstance(data, dict) and (data.get("executionType", None) == "code-snippet"):
        return RabbitRunExecutionContextCodeSnippetContext.from_dict(data)
    raise ValueError(f"Could not parse RabbitRunExecutionContext from dict: {data}")


@dataclass
class RabbitRunExecution:
    stage_id: RabbitRunExecutionStageId
    execution_id: RabbitRunExecutionExecutionId
    context: RabbitRunExecutionContext
    send_queue: typing.Optional[RabbitRunExecutionSendQueue] = field(
        default_factory=lambda: None
    )
    recv_queue: typing.Optional[RabbitRunExecutionRecvQueue] = field(
        default_factory=lambda: None
    )
    queue_expire_ms: typing.Optional[RabbitRunExecutionQueueExpireMs] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["stage_id"] = self.stage_id
        data["execution_id"] = self.execution_id
        data["context"] = self.context.to_dict()
        if self.send_queue is not None:
            data["send_queue"] = self.send_queue
        if self.recv_queue is not None:
            data["recv_queue"] = self.recv_queue
        if self.queue_expire_ms is not None:
            data["queue_expire_ms"] = self.queue_expire_ms
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "RabbitRunExecution":
        return cls(
            stage_id=str(data["stage_id"]),
            execution_id=str(data["execution_id"]),
            context=(
                RabbitRunExecutionContextJobContext.from_dict(data["context"])
                if isinstance(data["context"], dict)
                and (data["context"].get("executionType", None) == "job")
                else RabbitRunExecutionContextTaskletContext.from_dict(data["context"])
                if isinstance(data["context"], dict)
                and (data["context"].get("executionType", None) == "tasklet")
                else RabbitRunExecutionContextFormContext.from_dict(data["context"])
                if isinstance(data["context"], dict)
                and (data["context"].get("executionType", None) == "form")
                else RabbitRunExecutionContextHookContext.from_dict(data["context"])
                if isinstance(data["context"], dict)
                and (data["context"].get("executionType", None) == "hook")
                else RabbitRunExecutionContextCodeSnippetContext.from_dict(
                    data["context"]
                )
            ),
            send_queue=None
            if data.get("send_queue") is None
            else str(data["send_queue"]),
            recv_queue=None
            if data.get("recv_queue") is None
            else str(data["recv_queue"]),
            queue_expire_ms=None
            if data.get("queue_expire_ms") is None
            else int(data["queue_expire_ms"]),
        )


@dataclass
class RabbitRun:
    delivery_tag: RabbitRunDeliveryTag
    execution: RabbitRunExecution

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["delivery_tag"] = self.delivery_tag
        data["execution"] = self.execution.to_dict()
        return data

    @classmethod
    def from_dict(cls, data: typing.Dict[str, typing.Any]) -> "RabbitRun":
        return cls(
            delivery_tag=int(data["delivery_tag"]),
            execution=RabbitRunExecution.from_dict(data["execution"]),
        )


RabbitCloudWorkerExecutionMessageOperation = typing.Union[
    typing.Literal["create"], typing.Literal["update"]
]

RabbitCloudWorkerExecutionMessageOperationValues: typing.List[
    RabbitCloudWorkerExecutionMessageOperation
] = ["create", "update"]

RabbitCloudWorkerExecutionMessageId = str

RabbitCloudWorkerExecutionMessageProjectId = str

RabbitCloudWorkerExecutionMessageBuildId = str

RabbitCloudWorkerExecutionMessageStageId = str

RabbitCloudWorkerExecutionMessageStageRunId = str

RabbitCloudWorkerExecutionMessageWorkerId = str

RabbitCloudWorkerExecutionMessageAppId = str

RabbitCloudWorkerExecutionMessagePid = int

RabbitCloudWorkerExecutionMessageStatus = typing.Union[
    typing.Literal["running"],
    typing.Literal["lock-failed"],
    typing.Literal["failed"],
    typing.Literal["finished"],
    typing.Literal["abandoned"],
]

RabbitCloudWorkerExecutionMessageStatusValues: typing.List[
    RabbitCloudWorkerExecutionMessageStatus
] = ["running", "lock-failed", "failed", "finished", "abandoned"]

RabbitCloudWorkerExecutionMessageContext = typing.Dict[str, typing.Any]

RabbitCloudWorkerExecutionMessageCreatedAt = str

RabbitCloudWorkerExecutionMessagePublishedAt = str

RabbitCloudWorkerExecutionMessageMessageId = str


@dataclass
class RabbitCloudWorkerExecutionMessage:
    operation: RabbitCloudWorkerExecutionMessageOperation
    id: RabbitCloudWorkerExecutionMessageId
    build_id: RabbitCloudWorkerExecutionMessageBuildId
    published_at: RabbitCloudWorkerExecutionMessagePublishedAt
    message_id: RabbitCloudWorkerExecutionMessageMessageId
    project_id: typing.Optional[RabbitCloudWorkerExecutionMessageProjectId] = field(
        default_factory=lambda: None
    )
    stage_id: typing.Optional[RabbitCloudWorkerExecutionMessageStageId] = field(
        default_factory=lambda: None
    )
    stage_run_id: typing.Optional[RabbitCloudWorkerExecutionMessageStageRunId] = field(
        default_factory=lambda: None
    )
    worker_id: typing.Optional[RabbitCloudWorkerExecutionMessageWorkerId] = field(
        default_factory=lambda: None
    )
    app_id: typing.Optional[RabbitCloudWorkerExecutionMessageAppId] = field(
        default_factory=lambda: None
    )
    pid: typing.Optional[RabbitCloudWorkerExecutionMessagePid] = field(
        default_factory=lambda: None
    )
    status: typing.Optional[RabbitCloudWorkerExecutionMessageStatus] = field(
        default_factory=lambda: None
    )
    context: typing.Optional[RabbitCloudWorkerExecutionMessageContext] = field(
        default_factory=lambda: None
    )
    created_at: typing.Optional[RabbitCloudWorkerExecutionMessageCreatedAt] = field(
        default_factory=lambda: None
    )

    def to_dict(self) -> typing.Dict[str, typing.Any]:
        data = {}
        data["operation"] = self.operation
        data["id"] = self.id
        data["build_id"] = self.build_id
        data["published_at"] = self.published_at
        data["message_id"] = self.message_id
        if self.project_id is not None:
            data["project_id"] = self.project_id
        if self.stage_id is not None:
            data["stage_id"] = self.stage_id
        if self.stage_run_id is not None:
            data["stage_run_id"] = self.stage_run_id
        if self.worker_id is not None:
            data["worker_id"] = self.worker_id
        if self.app_id is not None:
            data["app_id"] = self.app_id
        if self.pid is not None:
            data["pid"] = self.pid
        if self.status is not None:
            data["status"] = self.status
        if self.context is not None:
            data["context"] = self.context
        if self.created_at is not None:
            data["created_at"] = self.created_at
        return data

    @classmethod
    def from_dict(
        cls, data: typing.Dict[str, typing.Any]
    ) -> "RabbitCloudWorkerExecutionMessage":
        return cls(
            operation=data["operation"],
            id=str(data["id"]),
            build_id=str(data["build_id"]),
            published_at=str(data["published_at"]),
            message_id=str(data["message_id"]),
            project_id=None
            if data.get("project_id") is None
            else str(data["project_id"]),
            stage_id=None if data.get("stage_id") is None else str(data["stage_id"]),
            stage_run_id=None
            if data.get("stage_run_id") is None
            else str(data["stage_run_id"]),
            worker_id=None if data.get("worker_id") is None else str(data["worker_id"]),
            app_id=None if data.get("app_id") is None else str(data["app_id"]),
            pid=None if data.get("pid") is None else int(data["pid"]),
            status=None if data.get("status") is None else data["status"],
            context=None if data.get("context") is None else dict(**data["context"]),
            created_at=None
            if data.get("created_at") is None
            else str(data["created_at"]),
        )
