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


class BillData(UniversalBaseModel):
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString], FieldMetadata(alias="AdditionalData")
    ] = None
    attachments: typing.Optional[Attachments] = None
    company: typing.Optional[str] = pydantic.Field(default=None)
    """
    Company name of the recipient of the invoice.
    """

    discount: typing.Optional[Discount] = None
    duty_amount: typing_extensions.Annotated[typing.Optional[DutyAmount], FieldMetadata(alias="dutyAmount")] = None
    first_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="firstName")] = pydantic.Field(
        default=None
    )
    """
    First name of the recipient of the invoice.
    """

    freight_amount: typing_extensions.Annotated[
        typing.Optional[FreightAmount], FieldMetadata(alias="freightAmount")
    ] = None
    frequency: typing.Optional[Frequency] = pydantic.Field(default=None)
    """
    Frequency of scheduled invoice.
    """

    invoice_amount: typing_extensions.Annotated[
        typing.Optional[InvoiceAmount], FieldMetadata(alias="invoiceAmount")
    ] = None
    invoice_date: typing_extensions.Annotated[typing.Optional[Datenullable], FieldMetadata(alias="invoiceDate")] = (
        pydantic.Field(default=None)
    )
    """
    Invoice date in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY.
    """

    invoice_due_date: typing_extensions.Annotated[
        typing.Optional[Datenullable], FieldMetadata(alias="invoiceDueDate")
    ] = pydantic.Field(default=None)
    """
    Invoice due date in one of the accepted formats: YYYY-MM-DD, MM/DD/YYYY.
    """

    invoice_end_date: typing_extensions.Annotated[
        typing.Optional[Datenullable], FieldMetadata(alias="invoiceEndDate")
    ] = pydantic.Field(default=None)
    """
    Indicate the date to finish a scheduled invoice cycle (`invoiceType`` = 1) in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY.
    """

    invoice_number: typing_extensions.Annotated[
        typing.Optional[InvoiceNumber], FieldMetadata(alias="invoiceNumber")
    ] = pydantic.Field(default=None)
    """
    Invoice number. Identifies the invoice under a paypoint.
    """

    invoice_status: typing_extensions.Annotated[
        typing.Optional[Invoicestatus], FieldMetadata(alias="invoiceStatus")
    ] = None
    invoice_type: typing_extensions.Annotated[typing.Optional[InvoiceType], FieldMetadata(alias="invoiceType")] = None
    items: typing.Optional[typing.List[BillItem]] = pydantic.Field(default=None)
    """
    Array of line items included in 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.
    """

    notes: typing.Optional[str] = pydantic.Field(default=None)
    """
    Notes included in the invoice.
    """

    payment_terms: typing_extensions.Annotated[
        typing.Optional[BillDataPaymentTerms], FieldMetadata(alias="paymentTerms")
    ] = None
    purchase_order: typing_extensions.Annotated[
        typing.Optional[PurchaseOrder], FieldMetadata(alias="purchaseOrder")
    ] = None
    shipping_address_1: typing_extensions.Annotated[
        typing.Optional[Shippingaddress], FieldMetadata(alias="shippingAddress1")
    ] = None
    shipping_address_2: typing_extensions.Annotated[
        typing.Optional[Shippingaddressadditional], FieldMetadata(alias="shippingAddress2")
    ] = None
    shipping_city: typing_extensions.Annotated[typing.Optional[Shippingcity], FieldMetadata(alias="shippingCity")] = (
        None
    )
    shipping_country: typing_extensions.Annotated[
        typing.Optional[Shippingcountry], FieldMetadata(alias="shippingCountry")
    ] = None
    shipping_email: typing_extensions.Annotated[typing.Optional[Email], FieldMetadata(alias="shippingEmail")] = (
        pydantic.Field(default=None)
    )
    """
    Shipping recipient's contact email address.
    """

    shipping_from_zip: typing_extensions.Annotated[
        typing.Optional[ShippingFromZip], FieldMetadata(alias="shippingFromZip")
    ] = None
    shipping_phone: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="shippingPhone")] = (
        pydantic.Field(default=None)
    )
    """
    Recipient phone number.
    """

    shipping_state: typing_extensions.Annotated[
        typing.Optional[Shippingstate], FieldMetadata(alias="shippingState")
    ] = None
    shipping_zip: typing_extensions.Annotated[typing.Optional[Shippingzip], FieldMetadata(alias="shippingZip")] = None
    summary_commodity_code: typing_extensions.Annotated[
        typing.Optional[SummaryCommodityCode], FieldMetadata(alias="summaryCommodityCode")
    ] = None
    tax: typing.Optional[Tax] = None
    terms_conditions: typing_extensions.Annotated[
        typing.Optional[TermsConditions], FieldMetadata(alias="termsConditions")
    ] = 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
