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

from __future__ import annotations
import httpx
from leonardo_ai_sdk.types import (
    BaseModel,
    Nullable,
    OptionalNullable,
    UNSET,
    UNSET_SENTINEL,
)
from leonardo_ai_sdk.utils import FieldMetadata, PathParamMetadata
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class DeleteGenerationByIDRequestTypedDict(TypedDict):
    id: str
    r"""The ID of the generation to delete."""


class DeleteGenerationByIDRequest(BaseModel):
    id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The ID of the generation to delete."""


class GenerationsTypedDict(TypedDict):
    r"""columns and relationships of \"generations\" """

    id: NotRequired[Nullable[str]]


class Generations(BaseModel):
    r"""columns and relationships of \"generations\" """

    id: OptionalNullable[str] = UNSET

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = ["id"]
        nullable_fields = ["id"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

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

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m


class DeleteGenerationByIDResponseBodyTypedDict(TypedDict):
    r"""Responses for DELETE /generations/{id}"""

    delete_generations_by_pk: NotRequired[Nullable[GenerationsTypedDict]]
    r"""columns and relationships of \"generations\" """


class DeleteGenerationByIDResponseBody(BaseModel):
    r"""Responses for DELETE /generations/{id}"""

    delete_generations_by_pk: OptionalNullable[Generations] = UNSET
    r"""columns and relationships of \"generations\" """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = ["delete_generations_by_pk"]
        nullable_fields = ["delete_generations_by_pk"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

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

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m


class DeleteGenerationByIDResponseTypedDict(TypedDict):
    content_type: str
    r"""HTTP response content type for this operation"""
    status_code: int
    r"""HTTP response status code for this operation"""
    raw_response: httpx.Response
    r"""Raw HTTP response; suitable for custom response parsing"""
    object: NotRequired[DeleteGenerationByIDResponseBodyTypedDict]
    r"""Responses for DELETE /generations/{id}"""


class DeleteGenerationByIDResponse(BaseModel):
    content_type: str
    r"""HTTP response content type for this operation"""

    status_code: int
    r"""HTTP response status code for this operation"""

    raw_response: httpx.Response
    r"""Raw HTTP response; suitable for custom response parsing"""

    object: Optional[DeleteGenerationByIDResponseBody] = None
    r"""Responses for DELETE /generations/{id}"""
