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

from __future__ import annotations
from .v4_pauseresumescheduleresponse import (
    V4PauseResumeScheduleResponse,
    V4PauseResumeScheduleResponseTypedDict,
)
import pydantic
from pydantic import model_serializer
from squadcast.types import BaseModel, UNSET_SENTINEL
from squadcast.utils import FieldMetadata, PathParamMetadata, RequestMetadata
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


Action = Literal[
    "pause",
    "resume",
]


class SchedulesPauseresumeScheduleRequestBodyTypedDict(TypedDict):
    action: NotRequired[Action]


class SchedulesPauseresumeScheduleRequestBody(BaseModel):
    action: Optional[Action] = None

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


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

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


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

    data: V4PauseResumeScheduleResponseTypedDict


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

    data: V4PauseResumeScheduleResponse
