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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .core_document_part import CoreDocumentPart
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CoreDocument(UniversalBaseModel):
    """
    The document structure that most closely corresponds to Vectara's internal document data model.
    """

    id: str = pydantic.Field()
    """
    The Document ID, must be unique within the corpus.
    """

    type: typing.Literal["core"] = "core"
    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Arbitrary object of document level metadata. Properties of this object
    can be used by document filter if defined as a corpus filter attribute.
    """

    document_parts: typing.List[CoreDocumentPart] = pydantic.Field()
    """
    Parts of the document that make up the document.
    """

    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
