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

from __future__ import annotations
from .emailchanneloverrides import EmailChannelOverrides, EmailChannelOverridesTypedDict
from .severitylevelenum import SeverityLevelEnum
from .stepsoverrides import StepsOverrides, StepsOverridesTypedDict
from .subscriberpayloaddto import SubscriberPayloadDto, SubscriberPayloadDtoTypedDict
from .tenantpayloaddto import TenantPayloadDto, TenantPayloadDtoTypedDict
from .topicpayloaddto import TopicPayloadDto, TopicPayloadDtoTypedDict
from novu_py.types import BaseModel
import pydantic
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


class ChannelsTypedDict(TypedDict):
    r"""Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides."""

    email: NotRequired[EmailChannelOverridesTypedDict]
    r"""Email channel specific overrides"""


class Channels(BaseModel):
    r"""Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides."""

    email: Optional[EmailChannelOverrides] = None
    r"""Email channel specific overrides"""


class OverridesTypedDict(TypedDict):
    r"""This could be used to override provider specific configurations"""

    steps: NotRequired[Dict[str, StepsOverridesTypedDict]]
    r"""This could be used to override provider specific configurations or layout at the step level"""
    channels: NotRequired[ChannelsTypedDict]
    r"""Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides."""
    providers: NotRequired[Dict[str, Dict[str, Any]]]
    r"""Overrides the provider configuration for the entire workflow and all steps"""
    email: NotRequired[Dict[str, Any]]
    r"""Override the email provider specific configurations for the entire workflow"""
    push: NotRequired[Dict[str, Any]]
    r"""Override the push provider specific configurations for the entire workflow"""
    sms: NotRequired[Dict[str, Any]]
    r"""Override the sms provider specific configurations for the entire workflow"""
    chat: NotRequired[Dict[str, Any]]
    r"""Override the chat provider specific configurations for the entire workflow"""
    layout_identifier: NotRequired[str]
    r"""Override the layout identifier for the entire workflow"""
    severity: NotRequired[SeverityLevelEnum]
    r"""Severity of the workflow"""


class Overrides(BaseModel):
    r"""This could be used to override provider specific configurations"""

    steps: Optional[Dict[str, StepsOverrides]] = None
    r"""This could be used to override provider specific configurations or layout at the step level"""

    channels: Optional[Channels] = None
    r"""Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides."""

    providers: Optional[Dict[str, Dict[str, Any]]] = None
    r"""Overrides the provider configuration for the entire workflow and all steps"""

    email: Annotated[
        Optional[Dict[str, Any]],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""Override the email provider specific configurations for the entire workflow"""

    push: Annotated[
        Optional[Dict[str, Any]],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""Override the push provider specific configurations for the entire workflow"""

    sms: Annotated[
        Optional[Dict[str, Any]],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""Override the sms provider specific configurations for the entire workflow"""

    chat: Annotated[
        Optional[Dict[str, Any]],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""Override the chat provider specific configurations for the entire workflow"""

    layout_identifier: Annotated[
        Optional[str],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.",
            alias="layoutIdentifier",
        ),
    ] = None
    r"""Override the layout identifier for the entire workflow"""

    severity: Optional[SeverityLevelEnum] = None
    r"""Severity of the workflow"""


To1TypedDict = TypeAliasType(
    "To1TypedDict", Union[TopicPayloadDtoTypedDict, SubscriberPayloadDtoTypedDict, str]
)


To1 = TypeAliasType("To1", Union[TopicPayloadDto, SubscriberPayloadDto, str])


ToTypedDict = TypeAliasType(
    "ToTypedDict",
    Union[
        TopicPayloadDtoTypedDict, SubscriberPayloadDtoTypedDict, List[To1TypedDict], str
    ],
)
r"""The recipients list of people who will receive the notification. Maximum number of recipients can be 100."""


To = TypeAliasType("To", Union[TopicPayloadDto, SubscriberPayloadDto, List[To1], str])
r"""The recipients list of people who will receive the notification. Maximum number of recipients can be 100."""


ActorTypedDict = TypeAliasType(
    "ActorTypedDict", Union[SubscriberPayloadDtoTypedDict, str]
)
r"""It is used to display the Avatar of the provided actor's subscriber id or actor object.

If a new actor object is provided, we will create a new subscriber in our system
"""


Actor = TypeAliasType("Actor", Union[SubscriberPayloadDto, str])
r"""It is used to display the Avatar of the provided actor's subscriber id or actor object.

If a new actor object is provided, we will create a new subscriber in our system
"""


TenantTypedDict = TypeAliasType(
    "TenantTypedDict", Union[TenantPayloadDtoTypedDict, str]
)
r"""It is used to specify a tenant context during trigger event.
Existing tenants will be updated with the provided details.
"""


Tenant = TypeAliasType("Tenant", Union[TenantPayloadDto, str])
r"""It is used to specify a tenant context during trigger event.
Existing tenants will be updated with the provided details.
"""


class TriggerEventRequestDtoContext2TypedDict(TypedDict):
    r"""Rich context object with id and optional data"""

    id: str
    data: NotRequired[Dict[str, Any]]
    r"""Optional additional context data"""


class TriggerEventRequestDtoContext2(BaseModel):
    r"""Rich context object with id and optional data"""

    id: str

    data: Optional[Dict[str, Any]] = None
    r"""Optional additional context data"""


TriggerEventRequestDtoContextTypedDict = TypeAliasType(
    "TriggerEventRequestDtoContextTypedDict",
    Union[TriggerEventRequestDtoContext2TypedDict, str],
)


TriggerEventRequestDtoContext = TypeAliasType(
    "TriggerEventRequestDtoContext", Union[TriggerEventRequestDtoContext2, str]
)


class TriggerEventRequestDtoTypedDict(TypedDict):
    workflow_id: str
    r"""The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page."""
    to: ToTypedDict
    r"""The recipients list of people who will receive the notification. Maximum number of recipients can be 100."""
    payload: NotRequired[Dict[str, Any]]
    r"""The payload object is used to pass additional custom information that could be
    used to render the workflow, or perform routing rules based on it.
    This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
    """
    overrides: NotRequired[OverridesTypedDict]
    r"""This could be used to override provider specific configurations"""
    transaction_id: NotRequired[str]
    r"""A unique identifier for deduplication. If the same **transactionId** is sent again,
    the trigger is ignored. Useful to prevent duplicate notifications. The retention period depends on your billing tier.
    """
    actor: NotRequired[ActorTypedDict]
    r"""It is used to display the Avatar of the provided actor's subscriber id or actor object.

    If a new actor object is provided, we will create a new subscriber in our system
    """
    tenant: NotRequired[TenantTypedDict]
    r"""It is used to specify a tenant context during trigger event.
    Existing tenants will be updated with the provided details.
    """
    context: NotRequired[Dict[str, TriggerEventRequestDtoContextTypedDict]]


class TriggerEventRequestDto(BaseModel):
    workflow_id: Annotated[str, pydantic.Field(alias="name")]
    r"""The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page."""

    to: To
    r"""The recipients list of people who will receive the notification. Maximum number of recipients can be 100."""

    payload: Optional[Dict[str, Any]] = None
    r"""The payload object is used to pass additional custom information that could be
    used to render the workflow, or perform routing rules based on it.
    This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
    """

    overrides: Optional[Overrides] = None
    r"""This could be used to override provider specific configurations"""

    transaction_id: Annotated[Optional[str], pydantic.Field(alias="transactionId")] = (
        None
    )
    r"""A unique identifier for deduplication. If the same **transactionId** is sent again,
    the trigger is ignored. Useful to prevent duplicate notifications. The retention period depends on your billing tier.
    """

    actor: Optional[Actor] = None
    r"""It is used to display the Avatar of the provided actor's subscriber id or actor object.

    If a new actor object is provided, we will create a new subscriber in our system
    """

    tenant: Optional[Tenant] = None
    r"""It is used to specify a tenant context during trigger event.
    Existing tenants will be updated with the provided details.
    """

    context: Optional[Dict[str, TriggerEventRequestDtoContext]] = None
