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

from __future__ import annotations
from .notificationtriggerdto import (
    NotificationTriggerDto,
    NotificationTriggerDtoTypedDict,
)
from .resourceoriginenum import ResourceOriginEnum
from novu_py.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ActivityNotificationTemplateResponseDtoTypedDict(TypedDict):
    name: str
    r"""Name of the template"""
    triggers: List[NotificationTriggerDtoTypedDict]
    r"""Triggers of the template"""
    id: NotRequired[str]
    r"""Unique identifier of the template"""
    origin: NotRequired[ResourceOriginEnum]
    r"""Origin of the layout"""


class ActivityNotificationTemplateResponseDto(BaseModel):
    name: str
    r"""Name of the template"""

    triggers: List[NotificationTriggerDto]
    r"""Triggers of the template"""

    id: Annotated[Optional[str], pydantic.Field(alias="_id")] = None
    r"""Unique identifier of the template"""

    origin: Optional[ResourceOriginEnum] = None
    r"""Origin of the layout"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["_id", "origin"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


try:
    ActivityNotificationTemplateResponseDto.model_rebuild()
except NameError:
    pass
