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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .document_part import DocumentPart
from .document_storage_usage import DocumentStorageUsage
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Document(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The document ID.
    """

    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    The document metadata.
    """

    parts: typing.Optional[typing.List[DocumentPart]] = pydantic.Field(default=None)
    """
    Parts of the document that make up the document. However, parts are not available when
    retrieving a list of documents or when creating a document. This property is only available
    when retrieving a document by ID.
    """

    storage_usage: typing.Optional[DocumentStorageUsage] = None

    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
