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

from ..core.unchecked_base_model import UncheckedBaseModel
from .catalog_category import CatalogCategory
from .catalog_item import CatalogItem
from .catalog_item_option import CatalogItemOption
from .catalog_modifier_list import CatalogModifierList
from .catalog_object_category import CatalogObjectCategory
from .catalog_object_item import CatalogObjectItem
from .catalog_object_item_option import CatalogObjectItemOption
from .catalog_object_modifier_list import CatalogObjectModifierList
from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan
from .catalog_subscription_plan import CatalogSubscriptionPlan
import pydantic
import typing
from .catalog_object import CatalogObject
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CreateCatalogImageRequest(UncheckedBaseModel):
    idempotency_key: str = pydantic.Field()
    """
    A unique string that identifies this CreateCatalogImage request.
    Keys can be any valid string but must be unique for every CreateCatalogImage request.
    
    See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
    """

    object_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this
    field empty to create unattached images, for example if you are building an integration
    where an image can be attached to catalog items at a later time.
    """

    image: CatalogObject = pydantic.Field()
    """
    The new `CatalogObject` of the `IMAGE` type, namely, a `CatalogImage` object, to encapsulate the specified image file.
    """

    is_primary: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`.
    If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image.
    If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object.
    
    With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`.
    """

    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
