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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .additional_data_map import AdditionalDataMap
from .contacts_response import ContactsResponse
from .email import Email
from .internal_reference_id import InternalReferenceId
from .location_code import LocationCode
from .mcc import Mcc
from .payee_name import PayeeName
from .remitaddress_1 import Remitaddress1
from .remitaddress_2 import Remitaddress2
from .remitcity import Remitcity
from .remitcountry import Remitcountry
from .remitstate import Remitstate
from .remitzip import Remitzip
from .vendor_data_response_payment_method import VendorDataResponsePaymentMethod
from .vendor_number import VendorNumber
from .vendor_response_billing_data import VendorResponseBillingData
from .vendor_response_stored_method import VendorResponseStoredMethod
from .vendor_response_summary import VendorResponseSummary
from .vendorid import Vendorid
from .vendorstatus import Vendorstatus


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

    from payabli import (
        ContactsResponse,
        VendorDataResponse,
        VendorResponseBillingData,
        VendorResponseSummary,
    )

    VendorDataResponse(
        vendor_number="1234",
        name_1="Herman's Coatings and Masonry",
        name_2="",
        ein="XXXX6789",
        phone="5555555555",
        email="contact@hermanscoatings.com",
        address_1="123 Ocean Drive",
        address_2="Suite 400",
        city="Miami",
        state="FL",
        zip="33139",
        country="US",
        mcc="7777",
        location_code="MIA123",
        contacts=[
            ContactsResponse(
                contact_name="Herman Martinez",
                contact_email="herman@hermanscoatings.com",
                contact_title="Owner",
                contact_phone="3055550000",
            )
        ],
        billing_data=VendorResponseBillingData(
            id=123,
            nickname="Checking Account",
            bank_name="Country Bank",
            routing_account="123123123",
            account_number="1XXXXXX3123",
            type_account="Checking",
            bank_account_holder_name="Gruzya Adventure Outfitters LLC",
            bank_account_holder_type="Business",
            bank_account_function=0,
            verified=True,
            status=1,
            services=[],
            default=True,
        ),
        payment_method="vcard",
        vendor_status=1,
        vendor_id=1234,
        summary=VendorResponseSummary(
            active_bills=5,
            pending_bills=2,
            in_transit_bills=1,
            paid_bills=10,
            overdue_bills=0,
            approved_bills=3,
            disapproved_bills=0,
            total_bills=21,
            active_bills_amount=1500.0,
            pending_bills_amount=500.0,
            in_transit_bills_amount=200.0,
            paid_bills_amount=3000.0,
            overdue_bills_amount=0.0,
            approved_bills_amount=800.0,
            disapproved_bills_amount=0.0,
            total_bills_amount=6000.0,
        ),
        paypoint_legalname="Gruzya Adventure Outfitters LLC",
        paypoint_dbaname="Gruzya Adventure Outfitters",
        paypoint_entryname="41035afaa7",
        parent_org_name="Pilgrim Planner",
        parent_org_id=1232,
        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="Herman Martinez",
        payee_name_2="",
        custom_field_1="",
        custom_field_2="",
        customer_vendor_account="A-37622",
        internal_reference_id=123,
        additional_data={
            "customField": "Custom Value 1",
            "reference": "REF-12345",
            "notes": "Additional vendor information",
        },
        external_paypoint_id="ext123",
        stored_methods=[],
    )
    """

    vendor_number: typing_extensions.Annotated[VendorNumber, FieldMetadata(alias="VendorNumber")]
    name_1: typing_extensions.Annotated[str, FieldMetadata(alias="Name1")] = pydantic.Field()
    """
    Primary name for vendor.
    """

    name_2: typing_extensions.Annotated[str, FieldMetadata(alias="Name2")] = pydantic.Field()
    """
    Secondary name for vendor.
    """

    ein: typing_extensions.Annotated[str, FieldMetadata(alias="EIN")] = pydantic.Field()
    """
    EIN/Tax ID for vendor. In responses, this field is masked, and looks like: `"ein": "XXXXX6789"`.
    """

    phone: typing_extensions.Annotated[str, FieldMetadata(alias="Phone")] = pydantic.Field()
    """
    Vendor's phone number.
    """

    email: typing_extensions.Annotated[Email, FieldMetadata(alias="Email")]
    remit_email: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="RemitEmail")] = pydantic.Field(
        default=None
    )
    """
    Email address for remittance
    """

    address_1: typing_extensions.Annotated[str, FieldMetadata(alias="Address1")] = pydantic.Field()
    """
    Vendor's address.
    """

    address_2: typing_extensions.Annotated[str, FieldMetadata(alias="Address2")] = pydantic.Field()
    """
    Additional line for vendor's address.
    """

    city: typing_extensions.Annotated[str, FieldMetadata(alias="City")] = pydantic.Field()
    """
    Vendor's city.
    """

    state: typing_extensions.Annotated[str, FieldMetadata(alias="State")] = pydantic.Field()
    """
    Vendor's state. Must be a two-character state code.
    """

    zip: typing_extensions.Annotated[str, FieldMetadata(alias="Zip")] = pydantic.Field()
    """
    Vendor's zip code.
    """

    country: typing_extensions.Annotated[str, FieldMetadata(alias="Country")] = pydantic.Field()
    """
    Vendor's country. Payabli supports only US and Canadian vendors.
    """

    mcc: typing_extensions.Annotated[Mcc, FieldMetadata(alias="Mcc")]
    location_code: typing_extensions.Annotated[LocationCode, FieldMetadata(alias="LocationCode")]
    contacts: typing_extensions.Annotated[typing.List[ContactsResponse], FieldMetadata(alias="Contacts")] = (
        pydantic.Field()
    )
    """
    Array of objects describing the vendor's contacts.
    """

    billing_data: typing_extensions.Annotated[VendorResponseBillingData, FieldMetadata(alias="BillingData")] = (
        pydantic.Field()
    )
    """
    Object containing vendor's bank information.
    """

    payment_method: typing_extensions.Annotated[
        VendorDataResponsePaymentMethod, FieldMetadata(alias="PaymentMethod")
    ] = pydantic.Field()
    """
    Preferred payment method for vendor.
    """

    vendor_status: typing_extensions.Annotated[Vendorstatus, FieldMetadata(alias="VendorStatus")]
    vendor_id: typing_extensions.Annotated[Vendorid, FieldMetadata(alias="VendorId")]
    enrollment_status: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="EnrollmentStatus")] = (
        pydantic.Field(default=None)
    )
    """
    Vendor enrollment status
    """

    summary: typing_extensions.Annotated[VendorResponseSummary, FieldMetadata(alias="Summary")] = pydantic.Field()
    """
    Vendor bill summary statistics
    """

    paypoint_legalname: typing_extensions.Annotated[str, FieldMetadata(alias="PaypointLegalname")] = pydantic.Field()
    """
    Legal name of the paypoint
    """

    paypoint_dbaname: typing_extensions.Annotated[str, FieldMetadata(alias="PaypointDbaname")] = pydantic.Field()
    """
    DBA name of the paypoint
    """

    paypoint_entryname: typing_extensions.Annotated[str, FieldMetadata(alias="PaypointEntryname")] = pydantic.Field()
    """
    Entry name of the paypoint
    """

    parent_org_name: typing_extensions.Annotated[str, FieldMetadata(alias="ParentOrgName")] = pydantic.Field()
    """
    Name of the parent organization
    """

    parent_org_id: typing_extensions.Annotated[int, FieldMetadata(alias="ParentOrgId")] = pydantic.Field()
    """
    ID of the parent organization
    """

    created_date: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="CreatedDate")] = pydantic.Field()
    """
    Date when vendor was created
    """

    last_updated: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="LastUpdated")] = pydantic.Field()
    """
    Date when vendor was last updated
    """

    remit_address_1: typing_extensions.Annotated[Remitaddress1, FieldMetadata(alias="remitAddress1")]
    remit_address_2: typing_extensions.Annotated[Remitaddress2, FieldMetadata(alias="remitAddress2")]
    remit_city: typing_extensions.Annotated[Remitcity, FieldMetadata(alias="remitCity")]
    remit_state: typing_extensions.Annotated[Remitstate, FieldMetadata(alias="remitState")]
    remit_zip: typing_extensions.Annotated[Remitzip, FieldMetadata(alias="remitZip")]
    remit_country: typing_extensions.Annotated[Remitcountry, FieldMetadata(alias="remitCountry")]
    payee_name_1: typing_extensions.Annotated[PayeeName, FieldMetadata(alias="payeeName1")]
    payee_name_2: typing_extensions.Annotated[PayeeName, FieldMetadata(alias="payeeName2")]
    custom_field_1: typing_extensions.Annotated[str, FieldMetadata(alias="customField1")] = pydantic.Field()
    """
    Custom field 1 for vendor
    """

    custom_field_2: typing_extensions.Annotated[str, FieldMetadata(alias="customField2")] = pydantic.Field()
    """
    Custom field 2 for vendor
    """

    customer_vendor_account: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="customerVendorAccount")
    ] = pydantic.Field(default=None)
    """
    Account number of paypoint in the Vendor side.
    """

    internal_reference_id: typing_extensions.Annotated[InternalReferenceId, FieldMetadata(alias="InternalReferenceId")]
    additional_data: typing_extensions.Annotated[AdditionalDataMap, FieldMetadata(alias="additionalData")]
    external_paypoint_id: typing_extensions.Annotated[str, FieldMetadata(alias="externalPaypointID")] = pydantic.Field()
    """
    External paypoint identifier
    """

    stored_methods: typing_extensions.Annotated[
        typing.List[VendorResponseStoredMethod], FieldMetadata(alias="StoredMethods")
    ] = pydantic.Field()
    """
    Array of stored payment methods for vendor
    """

    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
