# 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 .shopify_order_line_item import ShopifyOrderLineItem


class ShopifyOrder(UniversalBaseModel):
    """
    Simplified Shopify order data.

    Orders reference customers and products by their index in the respective lists.
    This allows orders to be created with proper references after products and customers exist.

    Attributes:
        customer_index: Index of the customer in the customers list (0-based)
        line_items: List of line items (products and quantities)
        financial_status: Order financial status (pending, paid, refunded, etc.)
    """

    customer_index: int = pydantic.Field()
    """
    Index of the customer in the customers list (0-based)
    """

    line_items: typing.List[ShopifyOrderLineItem] = pydantic.Field()
    """
    List of line items
    """

    financial_status: typing.Optional[str] = pydantic.Field(default=None)
    """
    Order financial status (pending, paid, refunded, etc.)
    """

    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
