# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .retrieval_metadata_type import RetrievalMetadataType


class RetrievalMetadata(UniversalBaseModel):
    document_title: typing.Optional[str] = pydantic.Field(default=None)
    """
    Extracted title from document
    """

    document_id: str = pydantic.Field()
    """
    Source document UUID
    """

    file_name: str = pydantic.Field()
    """
    Original filename
    """

    type: RetrievalMetadataType = pydantic.Field()
    """
    Content type
    """

    chunk_index: int = pydantic.Field()
    """
    Position of chunk within document
    """

    chunk_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    Token count of the chunk
    """

    page: typing.Optional[str] = pydantic.Field(default=None)
    """
    JSON array of page numbers (e.g. "[1, 2]")
    """

    date_created: dt.datetime = pydantic.Field()
    """
    When the chunk was indexed
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
