"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .chatstepupsertdto import ChatStepUpsertDto, ChatStepUpsertDtoTypedDict
from .customstepupsertdto import CustomStepUpsertDto, CustomStepUpsertDtoTypedDict
from .delaystepupsertdto import DelayStepUpsertDto, DelayStepUpsertDtoTypedDict
from .digeststepupsertdto import DigestStepUpsertDto, DigestStepUpsertDtoTypedDict
from .emailstepupsertdto import EmailStepUpsertDto, EmailStepUpsertDtoTypedDict
from .inappstepupsertdto import InAppStepUpsertDto, InAppStepUpsertDtoTypedDict
from .preferencesrequestdto import PreferencesRequestDto, PreferencesRequestDtoTypedDict
from .pushstepupsertdto import PushStepUpsertDto, PushStepUpsertDtoTypedDict
from .smsstepupsertdto import SmsStepUpsertDto, SmsStepUpsertDtoTypedDict
from .workfloworiginenum import WorkflowOriginEnum
from novu_py.types import BaseModel
from novu_py.utils import get_discriminator
import pydantic
from pydantic import Discriminator, Tag
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


UpdateWorkflowDtoStepsTypedDict = TypeAliasType(
    "UpdateWorkflowDtoStepsTypedDict",
    Union[
        InAppStepUpsertDtoTypedDict,
        EmailStepUpsertDtoTypedDict,
        SmsStepUpsertDtoTypedDict,
        PushStepUpsertDtoTypedDict,
        ChatStepUpsertDtoTypedDict,
        DelayStepUpsertDtoTypedDict,
        DigestStepUpsertDtoTypedDict,
        CustomStepUpsertDtoTypedDict,
    ],
)


UpdateWorkflowDtoSteps = Annotated[
    Union[
        Annotated[InAppStepUpsertDto, Tag("in_app")],
        Annotated[EmailStepUpsertDto, Tag("email")],
        Annotated[SmsStepUpsertDto, Tag("sms")],
        Annotated[PushStepUpsertDto, Tag("push")],
        Annotated[ChatStepUpsertDto, Tag("chat")],
        Annotated[DelayStepUpsertDto, Tag("delay")],
        Annotated[DigestStepUpsertDto, Tag("digest")],
        Annotated[CustomStepUpsertDto, Tag("custom")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]


class UpdateWorkflowDtoTypedDict(TypedDict):
    name: str
    r"""Name of the workflow"""
    steps: List[UpdateWorkflowDtoStepsTypedDict]
    r"""Steps of the workflow"""
    preferences: PreferencesRequestDtoTypedDict
    r"""Workflow preferences"""
    origin: WorkflowOriginEnum
    r"""Origin of the workflow"""
    description: NotRequired[str]
    r"""Description of the workflow"""
    tags: NotRequired[List[str]]
    r"""Tags associated with the workflow"""
    active: NotRequired[bool]
    r"""Whether the workflow is active"""
    workflow_id: NotRequired[str]
    r"""Workflow ID (allowed only for code-first workflows)"""
    payload_schema: NotRequired[Dict[str, Any]]
    r"""The payload JSON Schema for the workflow"""
    validate_payload: NotRequired[bool]
    r"""Enable or disable payload schema validation"""


class UpdateWorkflowDto(BaseModel):
    name: str
    r"""Name of the workflow"""

    steps: List[UpdateWorkflowDtoSteps]
    r"""Steps of the workflow"""

    preferences: PreferencesRequestDto
    r"""Workflow preferences"""

    origin: WorkflowOriginEnum
    r"""Origin of the workflow"""

    description: Optional[str] = None
    r"""Description of the workflow"""

    tags: Optional[List[str]] = None
    r"""Tags associated with the workflow"""

    active: Optional[bool] = False
    r"""Whether the workflow is active"""

    workflow_id: Annotated[Optional[str], pydantic.Field(alias="workflowId")] = None
    r"""Workflow ID (allowed only for code-first workflows)"""

    payload_schema: Annotated[
        Optional[Dict[str, Any]], pydantic.Field(alias="payloadSchema")
    ] = None
    r"""The payload JSON Schema for the workflow"""

    validate_payload: Annotated[
        Optional[bool], pydantic.Field(alias="validatePayload")
    ] = None
    r"""Enable or disable payload schema validation"""
