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

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


class BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute(UncheckedBaseModel):
    """
    Represents one upsert within the bulk operation.
    """

    custom_attribute: CustomAttribute = pydantic.Field()
    """
    The custom attribute to create or update, with the following fields:
    
    - `value`. This value must conform to the `schema` specified by the definition. 
    For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
    
    - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
    control, include this optional field and specify the current version of the custom attribute.
    """

    idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
    """
    A unique identifier for this request, used to ensure idempotency. 
    For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
    """

    order_id: str = pydantic.Field()
    """
    The ID of the target [order](entity:Order).
    """

    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
