# 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 PatchInvoicesIdRequestItemsItem(UniversalBaseModel):
    id: typing.Optional[int] = pydantic.Field(default=None)
    """
    Existing item ID to update. Omit to create a new item.
    """

    item: typing.Optional[int] = pydantic.Field(default=None)
    """
    Inventory item ID
    """

    name: typing.Optional[str] = None
    sku: typing.Optional[str] = None
    quantity: typing.Optional[float] = None
    price: typing.Optional[float] = None
    is_taxed: typing.Optional[bool] = None
    dimensions: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Item-level dimension mappings. Keys are dimension types, values are `erp_dimension_id` strings. Merges with existing dimensions. Set a value to `null` to remove only that dimension. Pass `{}` or omit the field to preserve existing dimensions.
    """

    custom_fields: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Item-level custom metadata fields. Replaces the stored item custom fields — omitted keys are reset to their configured default values.
    
    **Requirements**: Invoice item custom fields must be configured for your account before use. Returns a `400` error if no spec is found or if unrecognised keys are sent.
    """

    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
