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

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


class CreateOrderRequest(UncheckedBaseModel):
    order: typing.Optional[Order] = pydantic.Field(default=None)
    """
    The order to create. If this field is set, the only other top-level field that can be
    set is the `idempotency_key`.
    """

    idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
    """
    A value you specify that uniquely identifies this
    order among orders you have created.
    
    If you are unsure whether a particular order was created successfully,
    you can try it again with the same idempotency key without
    worrying about creating duplicate orders.
    
    For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
    """

    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
