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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class ReceiptCreateRequestItemsItem(UniversalBaseModel):
    """
    Each item requires quantity and one of: ottimate_po_item_id or po_external_item_id.
    """

    external_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    External unique identifier for this receipt item.
    """

    ottimate_po_item_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Ottimate-assigned PO item ID. Required unless po_external_item_id is provided.
    """

    po_external_item_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    External ID (dd_unique_key) of the PO item — used for lookup when ottimate_po_item_id is not provided.
    """

    quantity: float
    price: typing.Optional[float] = None
    uom: typing.Optional[str] = None

    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
