# 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 ...types.additional_data_string import AdditionalDataString
from ...types.attachments import Attachments
from ...types.bill_item import BillItem
from ...types.datenullable import Datenullable
from ...types.discount import Discount
from ...types.duty_amount import DutyAmount
from ...types.email import Email
from ...types.freight_amount import FreightAmount
from ...types.frequency import Frequency
from ...types.invoice_amount import InvoiceAmount
from ...types.invoice_number import InvoiceNumber
from ...types.invoice_type import InvoiceType
from ...types.invoicestatus import Invoicestatus
from ...types.purchase_order import PurchaseOrder
from ...types.shipping_from_zip import ShippingFromZip
from ...types.shippingaddress import Shippingaddress
from ...types.shippingaddressadditional import Shippingaddressadditional
from ...types.shippingcity import Shippingcity
from ...types.shippingcountry import Shippingcountry
from ...types.shippingstate import Shippingstate
from ...types.shippingzip import Shippingzip
from ...types.summary_commodity_code import SummaryCommodityCode
from ...types.tax import Tax
from ...types.terms_conditions import TermsConditions


class TransactionDetailInvoiceData(UniversalBaseModel):
    """
    Invoice information if transaction is associated with an invoice
    """

    invoice_number: typing_extensions.Annotated[
        typing.Optional[InvoiceNumber], FieldMetadata(alias="invoiceNumber"), pydantic.Field(alias="invoiceNumber")
    ] = None
    invoice_date: typing_extensions.Annotated[
        typing.Optional[Datenullable], FieldMetadata(alias="invoiceDate"), pydantic.Field(alias="invoiceDate")
    ] = None
    invoice_due_date: typing_extensions.Annotated[
        typing.Optional[Datenullable], FieldMetadata(alias="invoiceDueDate"), pydantic.Field(alias="invoiceDueDate")
    ] = None
    invoice_end_date: typing_extensions.Annotated[
        typing.Optional[Datenullable], FieldMetadata(alias="invoiceEndDate"), pydantic.Field(alias="invoiceEndDate")
    ] = None
    invoice_status: typing_extensions.Annotated[
        typing.Optional[Invoicestatus], FieldMetadata(alias="invoiceStatus"), pydantic.Field(alias="invoiceStatus")
    ] = None
    invoice_type: typing_extensions.Annotated[
        typing.Optional[InvoiceType], FieldMetadata(alias="invoiceType"), pydantic.Field(alias="invoiceType")
    ] = None
    frequency: typing.Optional[Frequency] = None
    payment_terms: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="paymentTerms"), pydantic.Field(alias="paymentTerms")
    ] = None
    terms_conditions: typing_extensions.Annotated[
        typing.Optional[TermsConditions],
        FieldMetadata(alias="termsConditions"),
        pydantic.Field(alias="termsConditions"),
    ] = None
    notes: typing.Optional[str] = None
    tax: typing.Optional[Tax] = None
    discount: typing.Optional[Discount] = None
    invoice_amount: typing_extensions.Annotated[
        typing.Optional[InvoiceAmount], FieldMetadata(alias="invoiceAmount"), pydantic.Field(alias="invoiceAmount")
    ] = None
    freight_amount: typing_extensions.Annotated[
        typing.Optional[FreightAmount], FieldMetadata(alias="freightAmount"), pydantic.Field(alias="freightAmount")
    ] = None
    duty_amount: typing_extensions.Annotated[
        typing.Optional[DutyAmount], FieldMetadata(alias="dutyAmount"), pydantic.Field(alias="dutyAmount")
    ] = None
    purchase_order: typing_extensions.Annotated[
        typing.Optional[PurchaseOrder], FieldMetadata(alias="purchaseOrder"), pydantic.Field(alias="purchaseOrder")
    ] = None
    first_name: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="firstName"), pydantic.Field(alias="firstName")
    ] = None
    last_name: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="lastName"), pydantic.Field(alias="lastName")
    ] = None
    company: typing.Optional[str] = None
    shipping_address_1: typing_extensions.Annotated[
        typing.Optional[Shippingaddress],
        FieldMetadata(alias="shippingAddress1"),
        pydantic.Field(alias="shippingAddress1"),
    ] = None
    shipping_address_2: typing_extensions.Annotated[
        typing.Optional[Shippingaddressadditional],
        FieldMetadata(alias="shippingAddress2"),
        pydantic.Field(alias="shippingAddress2"),
    ] = None
    shipping_city: typing_extensions.Annotated[
        typing.Optional[Shippingcity], FieldMetadata(alias="shippingCity"), pydantic.Field(alias="shippingCity")
    ] = None
    shipping_state: typing_extensions.Annotated[
        typing.Optional[Shippingstate], FieldMetadata(alias="shippingState"), pydantic.Field(alias="shippingState")
    ] = None
    shipping_zip: typing_extensions.Annotated[
        typing.Optional[Shippingzip], FieldMetadata(alias="shippingZip"), pydantic.Field(alias="shippingZip")
    ] = None
    shipping_country: typing_extensions.Annotated[
        typing.Optional[Shippingcountry],
        FieldMetadata(alias="shippingCountry"),
        pydantic.Field(alias="shippingCountry"),
    ] = None
    shipping_email: typing_extensions.Annotated[
        typing.Optional[Email], FieldMetadata(alias="shippingEmail"), pydantic.Field(alias="shippingEmail")
    ] = None
    shipping_phone: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="shippingPhone"), pydantic.Field(alias="shippingPhone")
    ] = None
    shipping_from_zip: typing_extensions.Annotated[
        typing.Optional[ShippingFromZip],
        FieldMetadata(alias="shippingFromZip"),
        pydantic.Field(alias="shippingFromZip"),
    ] = None
    summary_commodity_code: typing_extensions.Annotated[
        typing.Optional[SummaryCommodityCode],
        FieldMetadata(alias="summaryCommodityCode"),
        pydantic.Field(alias="summaryCommodityCode"),
    ] = None
    items: typing.Optional[typing.List[BillItem]] = None
    attachments: typing.Optional[Attachments] = None
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString],
        FieldMetadata(alias="additionalData"),
        pydantic.Field(alias="additionalData"),
    ] = 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
