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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .created_at import CreatedAt
from .dbaname import Dbaname
from .entrypointfield import Entrypointfield
from .item_commodity_code import ItemCommodityCode
from .item_description import ItemDescription
from .item_product_code import ItemProductCode
from .item_product_name import ItemProductName
from .item_unitof_measure import ItemUnitofMeasure
from .last_modified import LastModified
from .legalname import Legalname
from .org_parent_name import OrgParentName
from .page_identifier import PageIdentifier


class LineItemQueryRecord(UniversalBaseModel):
    created_at: typing_extensions.Annotated[typing.Optional[CreatedAt], FieldMetadata(alias="createdAt")] = (
        pydantic.Field(default=None)
    )
    """
    Timestamp of when line item was created, in UTC.
    """

    id: typing.Optional[int] = pydantic.Field(default=None)
    """
    Identifier of line item.
    """

    item_categories: typing_extensions.Annotated[
        typing.Optional[typing.List[typing.Optional[str]]], FieldMetadata(alias="itemCategories")
    ] = pydantic.Field(default=None)
    """
    Array of tags classifying item or product.
    """

    item_commodity_code: typing_extensions.Annotated[
        typing.Optional[ItemCommodityCode], FieldMetadata(alias="itemCommodityCode")
    ] = None
    item_cost: typing_extensions.Annotated[float, FieldMetadata(alias="itemCost")] = pydantic.Field()
    """
    Item or product price per unit.
    """

    item_description: typing_extensions.Annotated[
        typing.Optional[ItemDescription], FieldMetadata(alias="itemDescription")
    ] = None
    item_mode: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="itemMode")] = pydantic.Field(
        default=None
    )
    """
    Internal class of item or product: value '0' is only for invoices , '1' for bills, and '2' common for both.
    """

    item_product_code: typing_extensions.Annotated[
        typing.Optional[ItemProductCode], FieldMetadata(alias="itemProductCode")
    ] = None
    item_product_name: typing_extensions.Annotated[
        typing.Optional[ItemProductName], FieldMetadata(alias="itemProductName")
    ] = None
    item_qty: typing_extensions.Annotated[int, FieldMetadata(alias="itemQty")] = pydantic.Field()
    """
    Quantity of item or product.
    """

    item_unit_of_measure: typing_extensions.Annotated[
        typing.Optional[ItemUnitofMeasure], FieldMetadata(alias="itemUnitOfMeasure")
    ] = None
    last_updated: typing_extensions.Annotated[typing.Optional[LastModified], FieldMetadata(alias="lastUpdated")] = (
        pydantic.Field(default=None)
    )
    """
    Timestamp of when the line item was updated, in UTC.
    """

    pageidentifier: typing.Optional[PageIdentifier] = None
    parent_org_name: typing_extensions.Annotated[
        typing.Optional[OrgParentName], FieldMetadata(alias="ParentOrgName")
    ] = pydantic.Field(default=None)
    """
    The name of the paypoint's parent organization.
    """

    paypoint_dbaname: typing_extensions.Annotated[typing.Optional[Dbaname], FieldMetadata(alias="PaypointDbaname")] = (
        pydantic.Field(default=None)
    )
    """
    The paypoint's DBA name.
    """

    paypoint_entryname: typing_extensions.Annotated[
        typing.Optional[Entrypointfield], FieldMetadata(alias="PaypointEntryname")
    ] = pydantic.Field(default=None)
    """
    The paypoint's entryname (entrypoint) value.
    """

    paypoint_legalname: typing_extensions.Annotated[
        typing.Optional[Legalname], FieldMetadata(alias="PaypointLegalname")
    ] = pydantic.Field(default=None)
    """
    The paypoint's legal name.
    """

    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
