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

from __future__ import annotations
from .partitionfilter import PartitionFilter, PartitionFilterTypedDict
from lambdadb.types import BaseModel, UNSET_SENTINEL
from lambdadb.utils import FieldMetadata, PathParamMetadata, RequestMetadata
import pydantic
from pydantic import model_serializer
from typing import Any, Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class DeleteDocsRequestBodyTypedDict(TypedDict):
    ids: NotRequired[List[str]]
    r"""A list of document IDs."""
    filter_: NotRequired[Dict[str, Any]]
    r"""Query filter."""
    partition_filter: NotRequired[PartitionFilterTypedDict]


class DeleteDocsRequestBody(BaseModel):
    ids: Optional[List[str]] = None
    r"""A list of document IDs."""

    filter_: Annotated[Optional[Dict[str, Any]], pydantic.Field(alias="filter")] = None
    r"""Query filter."""

    partition_filter: Annotated[
        Optional[PartitionFilter], pydantic.Field(alias="partitionFilter")
    ] = None

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

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

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

        return m


class DeleteDocsRequestTypedDict(TypedDict):
    collection_name: str
    r"""Collection name."""
    request_body: DeleteDocsRequestBodyTypedDict


class DeleteDocsRequest(BaseModel):
    collection_name: Annotated[
        str,
        pydantic.Field(alias="collectionName"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""Collection name."""

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