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

from __future__ import annotations
from duckyai.types import BaseModel
from duckyai.utils import FieldMetadata, MultipartFormMetadata
import io
import pydantic
from typing import IO, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


class FileTypedDict(TypedDict):
    file_name: str
    content: Union[bytes, IO[bytes], io.BufferedReader]
    content_type: NotRequired[str]


class File(BaseModel):
    file_name: Annotated[
        str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True)
    ]

    content: Annotated[
        Union[bytes, IO[bytes], io.BufferedReader],
        pydantic.Field(alias=""),
        FieldMetadata(multipart=MultipartFormMetadata(content=True)),
    ]

    content_type: Annotated[
        Optional[str],
        pydantic.Field(alias="Content-Type"),
        FieldMetadata(multipart=True),
    ] = None


class MetadataTypedDict(TypedDict):
    r"""Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings."""


class Metadata(BaseModel):
    r"""Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings."""


class IndexFileRequestTypedDict(TypedDict):
    index_name: str
    r"""The name of the index to which the document will be added"""
    file: FileTypedDict
    r"""Only text-based files supported at this time."""
    doc_id: NotRequired[str]
    r"""The ID of the document. If not provided, a unique document ID will be automatically generated by the server"""
    title: NotRequired[str]
    r"""Title of the document to be indexed"""
    url: NotRequired[str]
    r"""URL associated with the document to be indexed"""
    metadata: NotRequired[MetadataTypedDict]
    r"""Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings."""


class IndexFileRequest(BaseModel):
    index_name: Annotated[str, FieldMetadata(multipart=True)]
    r"""The name of the index to which the document will be added"""

    file: Annotated[File, FieldMetadata(multipart=MultipartFormMetadata(file=True))]
    r"""Only text-based files supported at this time."""

    doc_id: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
    r"""The ID of the document. If not provided, a unique document ID will be automatically generated by the server"""

    title: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
    r"""Title of the document to be indexed"""

    url: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
    r"""URL associated with the document to be indexed"""

    metadata: Annotated[
        Optional[Metadata], FieldMetadata(multipart=MultipartFormMetadata(json=True))
    ] = None
    r"""Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings."""
