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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .purchase_order_detail_purchase_order_items_item import PurchaseOrderDetailPurchaseOrderItemsItem
from .purchase_order_detail_purchase_order_status import PurchaseOrderDetailPurchaseOrderStatus


class PurchaseOrderDetailPurchaseOrder(UniversalBaseModel):
    id: str
    external_id: typing.Optional[str] = None
    number: typing.Optional[str] = None
    status: PurchaseOrderDetailPurchaseOrderStatus
    ottimate_location_id: typing.Optional[int] = None
    ottimate_company_id: typing.Optional[int] = None
    date: typing.Optional[str] = None
    erp_vendor_id: typing.Optional[str] = None
    erp_vendor_name: typing.Optional[str] = None
    total_amount: typing.Optional[float] = None
    tax: typing.Optional[float] = None
    freight: typing.Optional[float] = None
    miscellaneous_charges: typing.Optional[float] = None
    invoice_number_ref: typing.Optional[str] = None
    is2way: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="is_2_way")] = None
    items: typing.Optional[typing.List[PurchaseOrderDetailPurchaseOrderItemsItem]] = None
    created_date: typing.Optional[dt.datetime] = None
    last_modified_date: typing.Optional[dt.datetime] = 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
