# 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.bill_approvals import BillApprovals
from ...types.bill_events import BillEvents
from ...types.bill_id import BillId
from ...types.billitems import Billitems
from ...types.billstatus import Billstatus
from ...types.created_at import CreatedAt
from ...types.datenullable import Datenullable
from ...types.dbaname import Dbaname
from ...types.documents_ref import DocumentsRef
from ...types.entity_id import EntityId
from ...types.entrypointfield import Entrypointfield
from ...types.external_paypoint_id import ExternalPaypointId
from ...types.frequency import Frequency
from ...types.last_modified import LastModified
from ...types.legalname import Legalname
from ...types.org_parent_id import OrgParentId
from ...types.org_parent_name import OrgParentName
from ...types.paylink_id import PaylinkId
from ...types.terms import Terms
from ...types.transaction_out_query_record import TransactionOutQueryRecord
from ...types.vendor_data_response import VendorDataResponse


class BillResponseData(UniversalBaseModel):
    id_bill: typing_extensions.Annotated[
        typing.Optional[BillId], FieldMetadata(alias="IdBill"), pydantic.Field(alias="IdBill")
    ] = None
    bill_number: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="BillNumber"),
        pydantic.Field(alias="BillNumber", description="Unique identifier for the bill."),
    ] = None
    net_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="NetAmount"),
        pydantic.Field(alias="NetAmount", description="Net amount owed in bill."),
    ] = None
    discount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="Discount"),
        pydantic.Field(alias="Discount", description="Bill discount amount."),
    ] = None
    total_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="TotalAmount"),
        pydantic.Field(alias="TotalAmount", description="Total amount for the bill."),
    ] = None
    bill_date: typing_extensions.Annotated[
        typing.Optional[Datenullable],
        FieldMetadata(alias="BillDate"),
        pydantic.Field(alias="BillDate", description="Date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY"),
    ] = None
    due_date: typing_extensions.Annotated[
        typing.Optional[Datenullable],
        FieldMetadata(alias="DueDate"),
        pydantic.Field(alias="DueDate", description="Due Date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY"),
    ] = None
    comments: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="Comments"),
        pydantic.Field(
            alias="Comments",
            description="Comments associated with the bill. For managed payables, the character limit is 200. For on demand payouts, the characters limit is 250.",
        ),
    ] = None
    batch_number: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="BatchNumber"),
        pydantic.Field(alias="BatchNumber", description="The batch number that the bill belongs to."),
    ] = None
    bill_items: typing_extensions.Annotated[
        typing.Optional[Billitems],
        FieldMetadata(alias="BillItems"),
        pydantic.Field(alias="BillItems", description="Array of `LineItems` contained in bill."),
    ] = None
    mode: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="Mode"),
        pydantic.Field(
            alias="Mode", description="Bill mode: value `0` for single/one-time bills, `1` for scheduled bills."
        ),
    ] = None
    payment_method: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="PaymentMethod"),
        pydantic.Field(alias="PaymentMethod", description="Payment method used for the bill."),
    ] = None
    payment_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="PaymentId"),
        pydantic.Field(alias="PaymentId", description="Payment ID associated with the bill."),
    ] = None
    accounting_field_1: typing_extensions.Annotated[
        typing.Optional[AccountingField],
        FieldMetadata(alias="AccountingField1"),
        pydantic.Field(alias="AccountingField1"),
    ] = None
    accounting_field_2: typing_extensions.Annotated[
        typing.Optional[AccountingField],
        FieldMetadata(alias="AccountingField2"),
        pydantic.Field(alias="AccountingField2"),
    ] = None
    terms: typing_extensions.Annotated[
        typing.Optional[Terms], FieldMetadata(alias="Terms"), pydantic.Field(alias="Terms")
    ] = None
    source: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="Source"),
        pydantic.Field(alias="Source", description='The source of the bill, such as "API" or "UI".'),
    ] = None
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString],
        FieldMetadata(alias="AdditionalData"),
        pydantic.Field(alias="AdditionalData"),
    ] = None
    vendor: typing_extensions.Annotated[
        typing.Optional[VendorDataResponse], FieldMetadata(alias="Vendor"), pydantic.Field(alias="Vendor")
    ] = None
    status: typing_extensions.Annotated[
        typing.Optional[Billstatus], FieldMetadata(alias="Status"), pydantic.Field(alias="Status")
    ] = None
    created_at: typing_extensions.Annotated[
        typing.Optional[CreatedAt], FieldMetadata(alias="CreatedAt"), pydantic.Field(alias="CreatedAt")
    ] = None
    end_date: typing_extensions.Annotated[
        typing.Optional[Datenullable],
        FieldMetadata(alias="EndDate"),
        pydantic.Field(alias="EndDate", description="End date for scheduled bills. Applied only in `Mode` = 1."),
    ] = None
    last_updated: typing_extensions.Annotated[
        typing.Optional[LastModified], FieldMetadata(alias="LastUpdated"), pydantic.Field(alias="LastUpdated")
    ] = None
    frequency: typing_extensions.Annotated[
        typing.Optional[Frequency],
        FieldMetadata(alias="Frequency"),
        pydantic.Field(alias="Frequency", description="Frequency for scheduled bills. Applied only in `Mode` = 1."),
    ] = None
    transaction: typing_extensions.Annotated[
        typing.Optional[TransactionOutQueryRecord],
        FieldMetadata(alias="Transaction"),
        pydantic.Field(alias="Transaction", description="MoneyOut transaction associated to the bill"),
    ] = None
    bill_events: typing_extensions.Annotated[
        typing.Optional[BillEvents], FieldMetadata(alias="billEvents"), pydantic.Field(alias="billEvents")
    ] = None
    bill_approvals: typing_extensions.Annotated[
        typing.Optional[BillApprovals], FieldMetadata(alias="billApprovals"), pydantic.Field(alias="billApprovals")
    ] = None
    paypoint_legalname: typing_extensions.Annotated[
        typing.Optional[Legalname], FieldMetadata(alias="PaypointLegalname"), pydantic.Field(alias="PaypointLegalname")
    ] = None
    paypoint_dbaname: typing_extensions.Annotated[
        typing.Optional[Dbaname], FieldMetadata(alias="PaypointDbaname"), pydantic.Field(alias="PaypointDbaname")
    ] = None
    parent_org_id: typing_extensions.Annotated[
        typing.Optional[OrgParentId], FieldMetadata(alias="ParentOrgId"), pydantic.Field(alias="ParentOrgId")
    ] = None
    parent_org_name: typing_extensions.Annotated[
        typing.Optional[OrgParentName], FieldMetadata(alias="ParentOrgName"), pydantic.Field(alias="ParentOrgName")
    ] = None
    paypoint_entryname: typing_extensions.Annotated[
        typing.Optional[Entrypointfield],
        FieldMetadata(alias="PaypointEntryname"),
        pydantic.Field(alias="PaypointEntryname"),
    ] = None
    paylink_id: typing_extensions.Annotated[
        typing.Optional[PaylinkId], FieldMetadata(alias="paylinkId"), pydantic.Field(alias="paylinkId")
    ] = None
    documents_ref: typing_extensions.Annotated[
        typing.Optional[DocumentsRef],
        FieldMetadata(alias="DocumentsRef"),
        pydantic.Field(alias="DocumentsRef", description="Object with the attached documents."),
    ] = None
    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[ExternalPaypointId],
        FieldMetadata(alias="externalPaypointID"),
        pydantic.Field(alias="externalPaypointID"),
    ] = None
    lot_number: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="LotNumber"),
        pydantic.Field(alias="LotNumber", description="Lot number of the bill."),
    ] = None
    entity_id: typing_extensions.Annotated[
        typing.Optional[EntityId], FieldMetadata(alias="EntityID"), pydantic.Field(alias="EntityID")
    ] = 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
