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

from __future__ import annotations
from enum import Enum
from moovio_sdk.models.components import (
    schedulelistresponse as components_schedulelistresponse,
)
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
from moovio_sdk.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class Hydrate(str, Enum):
    ACCOUNTS = "accounts"


class ListSchedulesRequestTypedDict(TypedDict):
    account_id: str
    skip: NotRequired[int]
    count: NotRequired[int]
    hydrate: NotRequired[Hydrate]


class ListSchedulesRequest(BaseModel):
    account_id: Annotated[
        str,
        pydantic.Field(alias="accountID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]

    skip: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    count: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    hydrate: Annotated[
        Optional[Hydrate],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["skip", "count", "hydrate"])
        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 ListSchedulesResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: List[components_schedulelistresponse.ScheduleListResponseTypedDict]


class ListSchedulesResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: List[components_schedulelistresponse.ScheduleListResponse]
