# 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.accounting_field import AccountingField
from ...types.additional_data_string import AdditionalDataString
from ...types.attachments import Attachments
from ...types.billitems import Billitems
from ...types.billstatus import Billstatus
from ...types.comments import Comments
from ...types.datenullable import Datenullable
from ...types.frequency import Frequency
from ...types.terms import Terms
from ...types.vendor_data import VendorData
from .bill_out_data_scheduled_options import BillOutDataScheduledOptions


class BillOutData(UniversalBaseModel):
    accounting_field_1: typing_extensions.Annotated[
        typing.Optional[AccountingField], FieldMetadata(alias="accountingField1")
    ] = None
    accounting_field_2: typing_extensions.Annotated[
        typing.Optional[AccountingField], FieldMetadata(alias="accountingField2")
    ] = None
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString], FieldMetadata(alias="additionalData")
    ] = None
    attachments: typing.Optional[Attachments] = pydantic.Field(default=None)
    """
    An array of bill images. Attachments aren't required, but we strongly recommend including them. Including a bill image can make payouts smoother and prevent delays. You can include either the Base64-encoded file content, or you can include an fURL to a public file. The maximum file size for image uploads is 30 MB.
    """

    bill_date: typing_extensions.Annotated[typing.Optional[Datenullable], FieldMetadata(alias="billDate")] = (
        pydantic.Field(default=None)
    )
    """
    Date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY.
    """

    bill_items: typing_extensions.Annotated[typing.Optional[Billitems], FieldMetadata(alias="billItems")] = None
    bill_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="billNumber")] = pydantic.Field(
        default=None
    )
    """
    Unique identifier for the bill. Required when adding a bill.
    """

    comments: typing.Optional[Comments] = None
    discount: typing.Optional[float] = pydantic.Field(default=None)
    """
    Discount amount applied to the bill.
    """

    due_date: typing_extensions.Annotated[typing.Optional[Datenullable], FieldMetadata(alias="dueDate")] = (
        pydantic.Field(default=None)
    )
    """
    Due date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY.
    """

    end_date: typing_extensions.Annotated[typing.Optional[Datenullable], FieldMetadata(alias="endDate")] = (
        pydantic.Field(default=None)
    )
    """
    End Date for scheduled bills. Applied only in `Mode` = 1. Accepted formats: YYYY-MM-DD, MM/DD/YYYY
    """

    frequency: typing.Optional[Frequency] = pydantic.Field(default=None)
    """
    Frequency for scheduled bills. Applied only in `Mode` = 1.
    """

    lot_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="lotNumber")] = pydantic.Field(
        default=None
    )
    """
    Lot number associated with the bill.
    """

    mode: typing.Optional[int] = pydantic.Field(default=None)
    """
    Bill mode: value `0` for one-time bills, `1` for scheduled bills.
    """

    net_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="netAmount")] = pydantic.Field(
        default=None
    )
    """
    Net Amount owed in bill. Required when adding a bill.
    """

    scheduled_options: typing_extensions.Annotated[
        typing.Optional[BillOutDataScheduledOptions], FieldMetadata(alias="scheduledOptions")
    ] = pydantic.Field(default=None)
    """
    Options for scheduled bills.
    """

    status: typing.Optional[Billstatus] = None
    terms: typing.Optional[Terms] = None
    total_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="totalAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Total amount of the bill.
    """

    vendor: typing.Optional[VendorData] = pydantic.Field(default=None)
    """
    The vendor associated with the bill. Although you can create a vendor in a create bill request, Payabli recommends creating a vendor separately and passing a valid `vendorNumber` here. At minimum, the `vendorNumber` is required. 
    """

    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
