# This file was auto-generated by Fern from our API Definition.

from ...core.pydantic_utilities import UniversalBaseModel
import typing
from .invoice_event import InvoiceEvent
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class InvoiceEventsResponse(UniversalBaseModel):
    """
    Examples
    --------
    import datetime

    from mercoa.commons import Address, PhoneNumber
    from mercoa.entity_types import (
        BusinessProfileResponse,
        CounterpartyCustomizationAccount,
        CounterpartyResponse,
        Ein,
        ProfileResponse,
        TaxId,
    )
    from mercoa.invoice_types import (
        InvoiceEvent,
        InvoiceEventsResponse,
        InvoiceResponse,
    )
    from mercoa.payment_method_types import PaymentMethodResponse_BankAccount

    InvoiceEventsResponse(
        data=[
            InvoiceEvent(
                webhook_ids=["webhook_12345"],
                user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506",
                data=InvoiceResponse(
                    id="inv_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9",
                    status="DRAFT",
                    payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
                    payer=CounterpartyResponse(
                        id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
                        foreign_id="MY-DB-ID-12345",
                        name="Acme Inc.",
                        email="customer@acme.com",
                        accepted_tos=True,
                        status="verified",
                        is_customer=True,
                        is_payor=True,
                        is_payee=False,
                        is_network_payor=False,
                        is_network_payee=False,
                        account_type="business",
                        updated_at=datetime.datetime.fromisoformat(
                            "2024-01-02 00:00:00+00:00",
                        ),
                        created_at=datetime.datetime.fromisoformat(
                            "2024-01-01 00:00:00+00:00",
                        ),
                        profile=ProfileResponse(
                            business=BusinessProfileResponse(
                                email="customer@acme.com",
                                legal_business_name="Acme Inc.",
                                business_type="llc",
                                phone=PhoneNumber(
                                    country_code="1",
                                    number="4155551234",
                                ),
                                address=Address(
                                    address_line_1="123 Main St",
                                    address_line_2="Unit 1",
                                    city="San Francisco",
                                    state_or_province="CA",
                                    postal_code="94105",
                                    country="US",
                                ),
                                tax_id_provided=True,
                                tax_id=TaxId(
                                    ein=Ein(
                                        number="12-3456789",
                                    ),
                                ),
                                owners_provided=True,
                            ),
                        ),
                        accounts=[
                            CounterpartyCustomizationAccount(
                                account_id="85866843",
                                postal_code="94105",
                                name_on_account="John Doe",
                            )
                        ],
                        payment_methods=[
                            PaymentMethodResponse_BankAccount(
                                id="pm_4794d597-70dc-4fec-b6ec-c5988e759769",
                                account_name="My Checking Account",
                                bank_name="Chase",
                                routing_number="12345678",
                                account_number="99988767623",
                                account_type="CHECKING",
                                status="VERIFIED",
                                is_default_source=True,
                                is_default_destination=True,
                                supported_currencies=["USD"],
                                metadata={},
                                frozen=False,
                                created_at=datetime.datetime.fromisoformat(
                                    "2021-01-01 00:00:00+00:00",
                                ),
                                updated_at=datetime.datetime.fromisoformat(
                                    "2021-01-01 00:00:00+00:00",
                                ),
                            )
                        ],
                        counterparty_type=["ENTITY"],
                    ),
                    payment_destination_confirmed=True,
                    has_documents=True,
                    has_source_email=True,
                    approvers=[],
                    approval_policy=[],
                    metadata={},
                    created_at=datetime.datetime.fromisoformat(
                        "2021-01-01 00:00:00+00:00",
                    ),
                    updated_at=datetime.datetime.fromisoformat(
                        "2021-01-01 00:00:00+00:00",
                    ),
                ),
                created_at=datetime.datetime.fromisoformat(
                    "2024-01-01 00:00:00+00:00",
                ),
            )
        ],
        count=1,
    )
    """

    data: typing.List[InvoiceEvent]
    count: int

    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
