# 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 .additional_data_string import AdditionalDataString
from .annualrevenue import Annualrevenue
from .application_data_pay_in_bank_data import ApplicationDataPayInBankData
from .application_data_pay_in_contacts_item import ApplicationDataPayInContactsItem
from .application_data_pay_in_ownership_item import ApplicationDataPayInOwnershipItem
from .application_data_pay_in_services import ApplicationDataPayInServices
from .avgmonthly import Avgmonthly
from .baddress_1 import Baddress1
from .baddress_2 import Baddress2
from .bcity import Bcity
from .bcountry import Bcountry
from .binperson import Binperson
from .binphone import Binphone
from .binweb import Binweb
from .boarding_average_bill_size import BoardingAverageBillSize
from .boarding_avg_monthly_bill import BoardingAvgMonthlyBill
from .bstate import Bstate
from .bsummary import Bsummary
from .busstartdate import Busstartdate
from .bzip import Bzip
from .dbaname import Dbaname
from .ein import Ein
from .email import Email
from .external_paypoint_id import ExternalPaypointId
from .fax_number import FaxNumber
from .highticketamt import Highticketamt
from .legalname import Legalname
from .license import License
from .licensestate import Licensestate
from .maddress import Maddress
from .maddress_1 import Maddress1
from .mcc import Mcc
from .mcity import Mcity
from .mcountry import Mcountry
from .mstate import Mstate
from .mzip import Mzip
from .orgid import Orgid
from .own_type import OwnType
from .phone_number import PhoneNumber
from .recipient_email_notification import RecipientEmailNotification
from .rep_code import RepCode
from .rep_name import RepName
from .rep_office import RepOffice
from .resumable import Resumable
from .signer_data_request import SignerDataRequest
from .taxfillname import Taxfillname
from .template_id import TemplateId
from .ticketamt import Ticketamt
from .website import Website
from .whencharged import Whencharged
from .whendelivered import Whendelivered
from .whenprovided import Whenprovided
from .whenrefunded import Whenrefunded


class ApplicationDataPayIn(UniversalBaseModel):
    """
    Fields for Pay In boarding applications.
    """

    services: ApplicationDataPayInServices
    annual_revenue: typing_extensions.Annotated[
        typing.Optional[Annualrevenue], FieldMetadata(alias="annualRevenue")
    ] = None
    average_bill_size: typing_extensions.Annotated[
        typing.Optional[BoardingAverageBillSize], FieldMetadata(alias="averageBillSize")
    ] = None
    average_monthly_bill: typing_extensions.Annotated[
        typing.Optional[BoardingAvgMonthlyBill], FieldMetadata(alias="averageMonthlyBill")
    ] = None
    avgmonthly: typing.Optional[Avgmonthly] = None
    baddress: typing.Optional[Baddress1] = None
    baddress_1: typing_extensions.Annotated[typing.Optional[Baddress2], FieldMetadata(alias="baddress1")] = None
    bank_data: typing_extensions.Annotated[ApplicationDataPayInBankData, FieldMetadata(alias="bankData")]
    bcity: typing.Optional[Bcity] = None
    bcountry: typing.Optional[Bcountry] = None
    binperson: typing.Optional[Binperson] = None
    binphone: typing.Optional[Binphone] = None
    binweb: typing.Optional[Binweb] = None
    boarding_link_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="boardingLinkId")] = (
        pydantic.Field(default=None)
    )
    """
    Boarding link ID for the application. Either `templateId` or `boardingLinkId` are required.
    """

    bstate: typing.Optional[Bstate] = None
    bsummary: typing.Optional[Bsummary] = None
    btype: typing.Optional[OwnType] = None
    bzip: typing.Optional[Bzip] = None
    contacts: typing.Optional[typing.List[ApplicationDataPayInContactsItem]] = pydantic.Field(default=None)
    """
    List of contacts for the business.
    """

    credit_limit: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="creditLimit")] = (
        pydantic.Field(default=None)
    )
    """
    The maximum amount of credit that our lending partner, has authorized to your business. It's the upper boundary on how much you can spend or owe on a credit account at any given time.
    """

    dba_name: typing_extensions.Annotated[typing.Optional[Dbaname], FieldMetadata(alias="dbaName")] = pydantic.Field(
        default=None
    )
    """
    The alternate or common name that this business is doing business under usually referred to as a DBA name. Payabli strongly recommends including this information.
    """

    ein: typing.Optional[Ein] = None
    externalpaypoint_id: typing_extensions.Annotated[
        typing.Optional[ExternalPaypointId], FieldMetadata(alias="externalpaypointID")
    ] = None
    faxnumber: typing.Optional[FaxNumber] = pydantic.Field(default=None)
    """
    The business's fax number.
    """

    highticketamt: typing.Optional[Highticketamt] = None
    legal_name: typing_extensions.Annotated[typing.Optional[Legalname], FieldMetadata(alias="legalName")] = None
    license: typing.Optional[License] = None
    licstate: typing.Optional[Licensestate] = None
    maddress: typing.Optional[Maddress] = None
    maddress_1: typing_extensions.Annotated[typing.Optional[Maddress1], FieldMetadata(alias="maddress1")] = None
    mcc: typing.Optional[Mcc] = None
    mcity: typing.Optional[Mcity] = None
    mcountry: typing.Optional[Mcountry] = None
    mstate: typing.Optional[Mstate] = None
    mzip: typing.Optional[Mzip] = None
    org_id: typing_extensions.Annotated[typing.Optional[Orgid], FieldMetadata(alias="orgId")] = None
    ownership: typing.Optional[typing.List[ApplicationDataPayInOwnershipItem]] = pydantic.Field(default=None)
    """
    List of Owners with at least a 25% ownership.
    """

    phonenumber: PhoneNumber = pydantic.Field()
    """
    The business's phone number.
    """

    processing_region: typing_extensions.Annotated[str, FieldMetadata(alias="processingRegion")] = pydantic.Field()
    """
    The business's processing region, either `US` or `CA`.
    """

    recipient_email: typing_extensions.Annotated[typing.Optional[Email], FieldMetadata(alias="recipientEmail")] = (
        pydantic.Field(default=None)
    )
    """
    Email address for the applicant. This is used to send the applicant a boarding link.
    """

    recipient_email_notification: typing_extensions.Annotated[
        typing.Optional[RecipientEmailNotification], FieldMetadata(alias="recipientEmailNotification")
    ] = None
    resumable: typing.Optional[Resumable] = None
    signer: SignerDataRequest
    startdate: typing.Optional[Busstartdate] = None
    tax_fill_name: typing_extensions.Annotated[typing.Optional[Taxfillname], FieldMetadata(alias="taxFillName")] = None
    template_id: typing_extensions.Annotated[typing.Optional[TemplateId], FieldMetadata(alias="templateId")] = (
        pydantic.Field(default=None)
    )
    """
    The associated boarding template's ID in Payabli. Either `templateId` or `boardingLinkId` are required.
    """

    ticketamt: typing.Optional[Ticketamt] = None
    website: typing.Optional[Website] = None
    when_charged: typing_extensions.Annotated[Whencharged, FieldMetadata(alias="whenCharged")]
    when_delivered: typing_extensions.Annotated[Whendelivered, FieldMetadata(alias="whenDelivered")]
    when_provided: typing_extensions.Annotated[Whenprovided, FieldMetadata(alias="whenProvided")]
    when_refunded: typing_extensions.Annotated[Whenrefunded, FieldMetadata(alias="whenRefunded")]
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalDataString], FieldMetadata(alias="additionalData")
    ] = None
    rep_code: typing_extensions.Annotated[typing.Optional[RepCode], FieldMetadata(alias="RepCode")] = None
    rep_name: typing_extensions.Annotated[typing.Optional[RepName], FieldMetadata(alias="RepName")] = None
    rep_office: typing_extensions.Annotated[typing.Optional[RepOffice], FieldMetadata(alias="RepOffice")] = 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
