# 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_map import AdditionalDataMap
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"), pydantic.Field(alias="invoiceId")
    ]
    customer_id: typing_extensions.Annotated[
        CustomerId, FieldMetadata(alias="customerId"), pydantic.Field(alias="customerId")
    ]
    paypoint_id: typing_extensions.Annotated[
        PaypointId, FieldMetadata(alias="paypointId"), pydantic.Field(alias="paypointId")
    ]
    invoice_number: typing_extensions.Annotated[
        InvoiceNumber, FieldMetadata(alias="invoiceNumber"), pydantic.Field(alias="invoiceNumber")
    ]
    invoice_date: typing_extensions.Annotated[
        Datenullable, FieldMetadata(alias="invoiceDate"), pydantic.Field(alias="invoiceDate")
    ]
    invoice_due_date: typing_extensions.Annotated[
        Datenullable, FieldMetadata(alias="invoiceDueDate"), pydantic.Field(alias="invoiceDueDate")
    ]
    invoice_sent_date: typing_extensions.Annotated[
        DatetimeNullable, FieldMetadata(alias="invoiceSentDate"), pydantic.Field(alias="invoiceSentDate")
    ]
    invoice_end_date: typing_extensions.Annotated[
        Datenullable, FieldMetadata(alias="invoiceEndDate"), pydantic.Field(alias="invoiceEndDate")
    ]
    last_payment_date: typing_extensions.Annotated[
        DatetimeNullable, FieldMetadata(alias="lastPaymentDate"), pydantic.Field(alias="lastPaymentDate")
    ]
    created_at: typing_extensions.Annotated[
        CreatedAt, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")
    ]
    invoice_status: typing_extensions.Annotated[
        Invoicestatus, FieldMetadata(alias="invoiceStatus"), pydantic.Field(alias="invoiceStatus")
    ]
    invoice_type: typing_extensions.Annotated[
        InvoiceType, FieldMetadata(alias="invoiceType"), pydantic.Field(alias="invoiceType")
    ]
    frequency: Frequency
    payment_terms: typing_extensions.Annotated[
        Terms, FieldMetadata(alias="paymentTerms"), pydantic.Field(alias="paymentTerms")
    ]
    terms_conditions: typing_extensions.Annotated[
        typing.Optional[TermsConditions],
        FieldMetadata(alias="termsConditions"),
        pydantic.Field(alias="termsConditions"),
    ] = None
    notes: typing.Optional[str] = None
    tax: Tax
    discount: Discount
    invoice_amount: typing_extensions.Annotated[
        InvoiceAmount, FieldMetadata(alias="invoiceAmount"), pydantic.Field(alias="invoiceAmount")
    ]
    invoice_paid_amount: typing_extensions.Annotated[
        InvoicePaidAmount, FieldMetadata(alias="invoicePaidAmount"), pydantic.Field(alias="invoicePaidAmount")
    ]
    freight_amount: typing_extensions.Annotated[
        FreightAmount, FieldMetadata(alias="freightAmount"), pydantic.Field(alias="freightAmount")
    ]
    duty_amount: typing_extensions.Annotated[
        DutyAmount, FieldMetadata(alias="dutyAmount"), pydantic.Field(alias="dutyAmount")
    ]
    purchase_order: typing_extensions.Annotated[
        PurchaseOrder, FieldMetadata(alias="purchaseOrder"), pydantic.Field(alias="purchaseOrder")
    ]
    first_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="firstName"),
        pydantic.Field(alias="firstName", description="First name of the recipient of the invoice."),
    ] = None
    last_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="lastName"),
        pydantic.Field(alias="lastName", description="Last name of the recipient of the invoice."),
    ] = None
    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"), pydantic.Field(alias="shippingAddress1")
    ]
    shipping_address_2: typing_extensions.Annotated[
        Shippingaddressadditional, FieldMetadata(alias="shippingAddress2"), pydantic.Field(alias="shippingAddress2")
    ]
    shipping_city: typing_extensions.Annotated[
        Shippingcity, FieldMetadata(alias="shippingCity"), pydantic.Field(alias="shippingCity")
    ]
    shipping_state: typing_extensions.Annotated[
        Shippingstate, FieldMetadata(alias="shippingState"), pydantic.Field(alias="shippingState")
    ]
    shipping_zip: typing_extensions.Annotated[
        Shippingzip, FieldMetadata(alias="shippingZip"), pydantic.Field(alias="shippingZip")
    ]
    shipping_from_zip: typing_extensions.Annotated[
        ShippingFromZip, FieldMetadata(alias="shippingFromZip"), pydantic.Field(alias="shippingFromZip")
    ]
    shipping_country: typing_extensions.Annotated[
        Shippingcountry, FieldMetadata(alias="shippingCountry"), pydantic.Field(alias="shippingCountry")
    ]
    shipping_email: typing_extensions.Annotated[
        Email, FieldMetadata(alias="shippingEmail"), pydantic.Field(alias="shippingEmail")
    ]
    shipping_phone: typing_extensions.Annotated[
        str, FieldMetadata(alias="shippingPhone"), pydantic.Field(alias="shippingPhone")
    ]
    summary_commodity_code: typing_extensions.Annotated[
        SummaryCommodityCode, FieldMetadata(alias="summaryCommodityCode"), pydantic.Field(alias="summaryCommodityCode")
    ]
    items: typing.List[BillItem]
    customer: typing_extensions.Annotated[
        PayorDataResponse, FieldMetadata(alias="Customer"), pydantic.Field(alias="Customer")
    ]
    paylink_id: typing_extensions.Annotated[
        PaylinkId, FieldMetadata(alias="paylinkId"), pydantic.Field(alias="paylinkId")
    ]
    bill_events: typing_extensions.Annotated[
        BillEvents, FieldMetadata(alias="billEvents"), pydantic.Field(alias="billEvents")
    ]
    scheduled_options: typing_extensions.Annotated[
        BillOptions, FieldMetadata(alias="scheduledOptions"), pydantic.Field(alias="scheduledOptions")
    ]
    paypoint_legalname: typing_extensions.Annotated[
        str, FieldMetadata(alias="PaypointLegalname"), pydantic.Field(alias="PaypointLegalname")
    ]
    paypoint_dbaname: typing_extensions.Annotated[
        Dbaname, FieldMetadata(alias="PaypointDbaname"), pydantic.Field(alias="PaypointDbaname")
    ]
    paypoint_entryname: typing_extensions.Annotated[
        Entrypointfield, FieldMetadata(alias="PaypointEntryname"), pydantic.Field(alias="PaypointEntryname")
    ]
    parent_org_name: typing_extensions.Annotated[
        OrgParentName, FieldMetadata(alias="ParentOrgName"), pydantic.Field(alias="ParentOrgName")
    ]
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataMap],
        FieldMetadata(alias="AdditionalData"),
        pydantic.Field(alias="AdditionalData"),
    ] = None
    documents_ref: typing_extensions.Annotated[
        DocumentsRef, FieldMetadata(alias="DocumentsRef"), pydantic.Field(alias="DocumentsRef")
    ]
    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[ExternalPaypointId],
        FieldMetadata(alias="externalPaypointID"),
        pydantic.Field(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
