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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .image_data import ImageData


class Image(UniversalBaseModel):
    """
    An image element within a document, containing its identifying information, optional metadata, and the actual image data.
    """

    id: str = pydantic.Field()
    """
    The unique identifier of the image within the document, used to reference it in related content.
    """

    title: typing.Optional[str] = pydantic.Field(default=None)
    """
    A short, human-readable title for the image, often displayed above or alongside it.
    """

    caption: typing.Optional[str] = pydantic.Field(default=None)
    """
    A brief caption providing context or an explanation for the image, typically displayed below it.
    """

    image_data: ImageData = pydantic.Field()
    """
    The actual image content and its format metadata.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    A longer, detailed description of the image for accessibility or additional context.
    """

    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
