# 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 .woo_commerce_order_line_item import WooCommerceOrderLineItem


class WooCommerceOrder(UniversalBaseModel):
    """
    Simplified WooCommerce order data.

    Orders reference customers and products by their index in the respective lists.

    Attributes:
        customer_index: Index of the customer in the customers list (0-based)
        line_items: List of line items
        status: Order status (pending, processing, completed, etc.)
        payment_method: Payment method ID
        payment_method_title: Payment method title
    """

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

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

    status: typing.Optional[str] = pydantic.Field(default=None)
    """
    Order status
    """

    payment_method: typing.Optional[str] = pydantic.Field(default=None)
    """
    Payment method ID
    """

    payment_method_title: typing.Optional[str] = pydantic.Field(default=None)
    """
    Payment method title
    """

    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
