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

from __future__ import annotations
from pydantic import model_serializer
from squadcast.types import BaseModel, UNSET_SENTINEL
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class V3ServicesNotificationDelayConfigRequestFixedTimeslotConfigTypedDict(TypedDict):
    start_time: NotRequired[str]
    end_time: NotRequired[str]
    repeat_days: NotRequired[List[int]]


class V3ServicesNotificationDelayConfigRequestFixedTimeslotConfig(BaseModel):
    start_time: Optional[str] = None

    end_time: Optional[str] = None

    repeat_days: Optional[List[int]] = None

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

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

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

        return m


class V3ServicesNotificationDelayConfigRequestCustomTimeslotsTypedDict(TypedDict):
    pass


class V3ServicesNotificationDelayConfigRequestCustomTimeslots(BaseModel):
    pass


class V3ServicesNotificationDelayConfigRequestAssignedToTypedDict(TypedDict):
    id: NotRequired[str]
    type: NotRequired[str]


class V3ServicesNotificationDelayConfigRequestAssignedTo(BaseModel):
    id: Optional[str] = None

    type: Optional[str] = None

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

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

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

        return m


class V3ServicesNotificationDelayConfigRequestTypedDict(TypedDict):
    is_enabled: bool
    timezone: NotRequired[str]
    fixed_timeslot_config: NotRequired[
        V3ServicesNotificationDelayConfigRequestFixedTimeslotConfigTypedDict
    ]
    custom_timeslots_enabled: NotRequired[bool]
    custom_timeslots: NotRequired[
        V3ServicesNotificationDelayConfigRequestCustomTimeslotsTypedDict
    ]
    assigned_to: NotRequired[
        V3ServicesNotificationDelayConfigRequestAssignedToTypedDict
    ]


class V3ServicesNotificationDelayConfigRequest(BaseModel):
    is_enabled: bool

    timezone: Optional[str] = None

    fixed_timeslot_config: Optional[
        V3ServicesNotificationDelayConfigRequestFixedTimeslotConfig
    ] = None

    custom_timeslots_enabled: Optional[bool] = None

    custom_timeslots: Optional[
        V3ServicesNotificationDelayConfigRequestCustomTimeslots
    ] = None

    assigned_to: Optional[V3ServicesNotificationDelayConfigRequestAssignedTo] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "timezone",
                "fixed_timeslot_config",
                "custom_timeslots_enabled",
                "custom_timeslots",
                "assigned_to",
            ]
        )
        serialized = handler(self)
        m = {}

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

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

        return m
