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

from __future__ import annotations
from .v4_changetimezoneresponse import (
    V4ChangeTimezoneResponse,
    V4ChangeTimezoneResponseTypedDict,
)
import pydantic
from pydantic import model_serializer
from squadcast.types import BaseModel, UNSET_SENTINEL
from squadcast.utils import FieldMetadata, PathParamMetadata, RequestMetadata
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class SchedulesChangeTimezoneRequestBodyTypedDict(TypedDict):
    time_zone: NotRequired[str]


class SchedulesChangeTimezoneRequestBody(BaseModel):
    time_zone: Annotated[Optional[str], pydantic.Field(alias="timeZone")] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["timeZone"])
        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 SchedulesChangeTimezoneRequestTypedDict(TypedDict):
    schedule_id: str
    request_body: SchedulesChangeTimezoneRequestBodyTypedDict


class SchedulesChangeTimezoneRequest(BaseModel):
    schedule_id: Annotated[
        str,
        pydantic.Field(alias="scheduleID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]

    request_body: Annotated[
        SchedulesChangeTimezoneRequestBody,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]


class SchedulesChangeTimezoneResponseTypedDict(TypedDict):
    r"""The request has succeeded."""

    data: V4ChangeTimezoneResponseTypedDict


class SchedulesChangeTimezoneResponse(BaseModel):
    r"""The request has succeeded."""

    data: V4ChangeTimezoneResponse


try:
    SchedulesChangeTimezoneRequestBody.model_rebuild()
except NameError:
    pass
