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

from __future__ import annotations
from .smscontroldto import SmsControlDto, SmsControlDtoTypedDict
from .uischema import UISchema, UISchemaTypedDict
from novu_py.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Any, Dict, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class SmsControlsMetadataResponseDtoTypedDict(TypedDict):
    values: SmsControlDtoTypedDict
    r"""Control values specific to SMS"""
    data_schema: NotRequired[Dict[str, Any]]
    r"""JSON Schema for data"""
    ui_schema: NotRequired[UISchemaTypedDict]
    r"""UI Schema for rendering"""


class SmsControlsMetadataResponseDto(BaseModel):
    values: SmsControlDto
    r"""Control values specific to SMS"""

    data_schema: Annotated[
        Optional[Dict[str, Any]], pydantic.Field(alias="dataSchema")
    ] = None
    r"""JSON Schema for data"""

    ui_schema: Annotated[Optional[UISchema], pydantic.Field(alias="uiSchema")] = None
    r"""UI Schema for rendering"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["dataSchema", "uiSchema"])
        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:
    SmsControlsMetadataResponseDto.model_rebuild()
except NameError:
    pass
