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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CatalogImage(UncheckedBaseModel):
    """
    An image file to use in Square catalogs. It can be associated with
    `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects.
    Only the images on items and item variations are exposed in Dashboard.
    Only the first image on an item is displayed in Square Point of Sale (SPOS).
    Images on items and variations are displayed through Square Online Store.
    Images on other object types are for use by 3rd party application developers.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The internal name to identify this image in calls to the Square API.
    This is a searchable attribute for use in applicable query filters
    using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
    It is not unique and should not be shown in a buyer facing context.
    """

    url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL of this image, generated by Square after an image is uploaded
    using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint.
    To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field.
    """

    caption: typing.Optional[str] = pydantic.Field(default=None)
    """
    A caption that describes what is shown in the image. Displayed in the
    Square Online Store. This is a searchable attribute for use in applicable query filters
    using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
    """

    photo_studio_order_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The immutable order ID for this image object created by the Photo Studio service in Square Online Store.
    """

    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
