# 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.query_summary import QuerySummary
from .payout_subscription_query_record_pascal import PayoutSubscriptionQueryRecordPascal


class QueryPayoutSubscriptionResponse(UniversalBaseModel):
    """
    Payout subscription query response body.

    Examples
    --------
    import datetime

    from payabli import (
        BillingDataResponse,
        BillPayOutData,
        ContactsResponse,
        GeneralEvents,
        PaymentDetail,
        QueryPaymentData,
        QuerySummary,
        VendorQueryRecord,
        VendorSummary,
    )
    from payabli.payout_subscription import (
        PayoutSubscriptionQueryRecordPascal,
        QueryPayoutSubscriptionResponse,
    )

    QueryPayoutSubscriptionResponse(
        summary=QuerySummary(
            total_records=1,
            total_amount=500.0,
            total_net_amount=500.0,
            total_pages=1,
            page_size=20,
            page_identifier="XXXXXXXXXXXXXXXXXXX",
        ),
        records=[
            PayoutSubscriptionQueryRecordPascal(
                id_out_subscription=42,
                status=1,
                events=[
                    GeneralEvents(
                        description="TransferCreated",
                        event_time=datetime.datetime.fromisoformat(
                            "2025-09-01 06:00:00+00:00",
                        ),
                        extra_data={"key": "value"},
                        ref_data="refData",
                        source="api",
                    )
                ],
                vendor=VendorQueryRecord(
                    vendor_number="1234",
                    name_1="Herman's Coatings",
                    name_2="Herman's Coating Supply Company, LLC",
                    ein="123456789",
                    phone="2125551234",
                    email="example@email.com",
                    address_1="123 Ocean Drive",
                    address_2="Suite 400",
                    city="Bristol",
                    state="GA",
                    zip="31113",
                    country="US",
                    mcc="7777",
                    location_code="LOC123",
                    contacts=ContactsResponse(
                        contact_email="eric@martinezcoatings.com",
                        contact_name="Eric Martinez",
                        contact_phone="5555555555",
                        contact_title="Owner",
                    ),
                    billing_data=BillingDataResponse(
                        id=123456,
                        account_id="bank-account-001",
                        nickname="Main Checking Account",
                        bank_name="Example Bank",
                        routing_account="123456789",
                        account_number="9876543210",
                        type_account="Checking",
                        bank_account_holder_name="John Doe",
                        bank_account_holder_type="Business",
                        bank_account_function=2,
                        verified=True,
                        status=1,
                        services=[],
                        default=True,
                    ),
                    vendor_status=1,
                    vendor_id=1,
                    summary=VendorSummary(
                        active_bills=2,
                        pending_bills=4,
                        in_transit_bills=3,
                        paid_bills=18,
                        overdue_bills=1,
                        approved_bills=5,
                        disapproved_bills=1,
                        total_bills=34,
                        active_bills_amount=1250.75,
                        pending_bills_amount=2890.5,
                        in_transit_bills_amount=1675.25,
                        paid_bills_amount=15420.8,
                        overdue_bills_amount=425.0,
                        approved_bills_amount=3240.9,
                        disapproved_bills_amount=180.0,
                        total_bills_amount=25083.2,
                    ),
                    paypoint_legalname="Sunshine Services, LLC",
                    paypoint_dbaname="Sunshine Gutters",
                    paypoint_entryname="d193cf9a46",
                    parent_org_name="PropertyManager Pro",
                    parent_org_id=1000,
                    created_date=datetime.datetime.fromisoformat(
                        "2022-07-01 15:00:01+00:00",
                    ),
                    last_updated=datetime.datetime.fromisoformat(
                        "2022-07-01 15:00:01+00:00",
                    ),
                    remit_address_1="123 Walnut Street",
                    remit_address_2="Suite 900",
                    remit_city="Miami",
                    remit_state="FL",
                    remit_zip="31113",
                    remit_country="US",
                    payee_name_1="payeeName1",
                    payee_name_2="payeeName2",
                    custom_field_1="",
                    custom_field_2="",
                    customer_vendor_account="123-456",
                    internal_reference_id=1000000,
                    external_paypoint_id="Paypoint-100",
                    stored_methods=[],
                ),
                bill_data=[
                    BillPayOutData(
                        bill_id=3001,
                        invoice_number="INV-5001",
                        net_amount="500",
                        invoice_date=datetime.date.fromisoformat(
                            "2025-08-01",
                        ),
                        due_date=datetime.date.fromisoformat(
                            "2025-08-15",
                        ),
                    )
                ],
                external_paypoint_id="d193cf9a46-10",
                method="ach",
                paypoint_id=255,
                total_amount=500.0,
                net_amount=500.0,
                fee_amount=0.0,
                payment_data=QueryPaymentData(
                    account_type="checking",
                    holder_name="Herman Coatings",
                    initiator="merchant",
                    masked_account="XXXXXX5666",
                    payment_details=PaymentDetail(
                        currency="USD",
                        service_fee=0.0,
                        total_amount=500.0,
                    ),
                    sequence="subsequent",
                    stored_method_usage_type="recurring",
                ),
                start_date=datetime.datetime.fromisoformat(
                    "2025-09-01 00:00:00+00:00",
                ),
                end_date=datetime.datetime.fromisoformat(
                    "2026-09-01 00:00:00+00:00",
                ),
                next_date=datetime.datetime.fromisoformat(
                    "2025-10-01 00:00:00+00:00",
                ),
                frequency="monthly",
                total_cycles=12,
                left_cycles=11,
                last_run=datetime.datetime.fromisoformat(
                    "2025-09-01 06:00:00+00:00",
                ),
                entrypage_id=0,
                until_cancelled=False,
                last_updated=datetime.datetime.fromisoformat(
                    "2025-08-01 12:00:00+00:00",
                ),
                created_at=datetime.datetime.fromisoformat(
                    "2025-08-01 12:00:00+00:00",
                ),
                paypoint_legalname="Sunshine Services, LLC",
                paypoint_dbaname="Sunshine Gutters",
                paypoint_entryname="d193cf9a46",
                parent_org_name="PropertyManager Pro",
                parent_org_id=236,
                source="api",
            )
        ],
    )
    """

    summary: typing_extensions.Annotated[
        typing.Optional[QuerySummary], FieldMetadata(alias="Summary"), pydantic.Field(alias="Summary")
    ] = None
    records: typing_extensions.Annotated[
        typing.Optional[typing.List[PayoutSubscriptionQueryRecordPascal]],
        FieldMetadata(alias="Records"),
        pydantic.Field(alias="Records"),
    ] = 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
