# 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.bill_events import BillEvents
from ...types.bill_item import BillItem
from ...types.bill_options import BillOptions
from ...types.created_at import CreatedAt
from ...types.customer_id import CustomerId
from ...types.datenullable import Datenullable
from ...types.datetime_nullable import DatetimeNullable
from ...types.dbaname import Dbaname
from ...types.discount import Discount
from ...types.documents_ref import DocumentsRef
from ...types.duty_amount import DutyAmount
from ...types.email import Email
from ...types.entrypointfield import Entrypointfield
from ...types.external_paypoint_id import ExternalPaypointId
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.org_parent_name import OrgParentName
from ...types.paylink_id import PaylinkId
from ...types.payor_data_response import PayorDataResponse
from ...types.paypoint_id import PaypointId
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 import Terms
from ...types.terms_conditions import TermsConditions
from .invoice_id import InvoiceId
from .invoice_paid_amount import InvoicePaidAmount


class GetInvoiceRecord(UniversalBaseModel):
    invoice_id: typing_extensions.Annotated[InvoiceId, FieldMetadata(alias="invoiceId")]
    customer_id: typing_extensions.Annotated[CustomerId, FieldMetadata(alias="customerId")]
    paypoint_id: typing_extensions.Annotated[PaypointId, FieldMetadata(alias="paypointId")]
    invoice_number: typing_extensions.Annotated[InvoiceNumber, FieldMetadata(alias="invoiceNumber")]
    invoice_date: typing_extensions.Annotated[Datenullable, FieldMetadata(alias="invoiceDate")]
    invoice_due_date: typing_extensions.Annotated[Datenullable, FieldMetadata(alias="invoiceDueDate")]
    invoice_sent_date: typing_extensions.Annotated[DatetimeNullable, FieldMetadata(alias="invoiceSentDate")]
    invoice_end_date: typing_extensions.Annotated[Datenullable, FieldMetadata(alias="invoiceEndDate")]
    last_payment_date: typing_extensions.Annotated[DatetimeNullable, FieldMetadata(alias="lastPaymentDate")]
    created_at: typing_extensions.Annotated[CreatedAt, FieldMetadata(alias="createdAt")]
    invoice_status: typing_extensions.Annotated[Invoicestatus, FieldMetadata(alias="invoiceStatus")]
    invoice_type: typing_extensions.Annotated[InvoiceType, FieldMetadata(alias="invoiceType")]
    frequency: Frequency
    payment_terms: typing_extensions.Annotated[Terms, FieldMetadata(alias="paymentTerms")]
    terms_conditions: typing_extensions.Annotated[
        typing.Optional[TermsConditions], FieldMetadata(alias="termsConditions")
    ] = None
    notes: typing.Optional[str] = None
    tax: Tax
    discount: Discount
    invoice_amount: typing_extensions.Annotated[InvoiceAmount, FieldMetadata(alias="invoiceAmount")]
    invoice_paid_amount: typing_extensions.Annotated[InvoicePaidAmount, FieldMetadata(alias="invoicePaidAmount")]
    freight_amount: typing_extensions.Annotated[FreightAmount, FieldMetadata(alias="freightAmount")]
    duty_amount: typing_extensions.Annotated[DutyAmount, FieldMetadata(alias="dutyAmount")]
    purchase_order: typing_extensions.Annotated[PurchaseOrder, FieldMetadata(alias="purchaseOrder")]
    first_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="firstName")] = pydantic.Field(
        default=None
    )
    """
    First name of the recipient of the invoice.
    """

    last_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="lastName")] = pydantic.Field(
        default=None
    )
    """
    Last name of the recipient of the invoice.
    """

    company: typing.Optional[str] = pydantic.Field(default=None)
    """
    Company name of the recipient of the invoice.
    """

    shipping_address_1: typing_extensions.Annotated[Shippingaddress, FieldMetadata(alias="shippingAddress1")]
    shipping_address_2: typing_extensions.Annotated[Shippingaddressadditional, FieldMetadata(alias="shippingAddress2")]
    shipping_city: typing_extensions.Annotated[Shippingcity, FieldMetadata(alias="shippingCity")]
    shipping_state: typing_extensions.Annotated[Shippingstate, FieldMetadata(alias="shippingState")]
    shipping_zip: typing_extensions.Annotated[Shippingzip, FieldMetadata(alias="shippingZip")]
    shipping_from_zip: typing_extensions.Annotated[ShippingFromZip, FieldMetadata(alias="shippingFromZip")]
    shipping_country: typing_extensions.Annotated[Shippingcountry, FieldMetadata(alias="shippingCountry")]
    shipping_email: typing_extensions.Annotated[Email, FieldMetadata(alias="shippingEmail")]
    shipping_phone: typing_extensions.Annotated[str, FieldMetadata(alias="shippingPhone")]
    summary_commodity_code: typing_extensions.Annotated[
        SummaryCommodityCode, FieldMetadata(alias="summaryCommodityCode")
    ]
    items: typing.List[BillItem]
    customer: typing_extensions.Annotated[PayorDataResponse, FieldMetadata(alias="Customer")]
    paylink_id: typing_extensions.Annotated[PaylinkId, FieldMetadata(alias="paylinkId")]
    bill_events: typing_extensions.Annotated[BillEvents, FieldMetadata(alias="billEvents")]
    scheduled_options: typing_extensions.Annotated[BillOptions, FieldMetadata(alias="scheduledOptions")]
    paypoint_legalname: typing_extensions.Annotated[str, FieldMetadata(alias="PaypointLegalname")]
    paypoint_dbaname: typing_extensions.Annotated[Dbaname, FieldMetadata(alias="PaypointDbaname")]
    paypoint_entryname: typing_extensions.Annotated[Entrypointfield, FieldMetadata(alias="PaypointEntryname")]
    parent_org_name: typing_extensions.Annotated[OrgParentName, FieldMetadata(alias="ParentOrgName")]
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString], FieldMetadata(alias="AdditionalData")
    ] = None
    documents_ref: typing_extensions.Annotated[DocumentsRef, FieldMetadata(alias="DocumentsRef")]
    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[ExternalPaypointId], FieldMetadata(alias="externalPaypointID")
    ] = 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
