# 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 .transfer_out_bank_account import TransferOutBankAccount
from .transfer_out_event_data import TransferOutEventData
from .transfer_out_message import TransferOutMessage


class TransferOutRecord(UniversalBaseModel):
    """
    A record representing an outbound transfer.
    """

    transfer_id: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="transferId"),
        pydantic.Field(alias="transferId", description="Unique identifier for the transfer."),
    ] = None
    paypoint_id: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="paypointId"),
        pydantic.Field(alias="paypointId", description="The ID of the paypoint associated with the transfer."),
    ] = None
    batch_number: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="batchNumber"),
        pydantic.Field(alias="batchNumber", description="The batch number for the transfer."),
    ] = None
    batch_currency: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="batchCurrency"),
        pydantic.Field(alias="batchCurrency", description="The currency of the batch."),
    ] = None
    batch_records: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="batchRecords"),
        pydantic.Field(alias="batchRecords", description="The number of records in the batch."),
    ] = None
    transfer_identifier: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="transferIdentifier"),
        pydantic.Field(alias="transferIdentifier", description="An identifier for the transfer."),
    ] = None
    batch_id: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="batchId"),
        pydantic.Field(alias="batchId", description="The ID of the batch."),
    ] = None
    batch_net_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="batchNetAmount"),
        pydantic.Field(alias="batchNetAmount", description="The net amount of the batch."),
    ] = None
    batch_status: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="batchStatus"),
        pydantic.Field(alias="batchStatus", description="The status of the batch."),
    ] = None
    paypoint_entry_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="paypointEntryName"),
        pydantic.Field(alias="paypointEntryName", description="The entry name for the paypoint."),
    ] = None
    paypoint_legal_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="paypointLegalName"),
        pydantic.Field(alias="paypointLegalName", description="The legal name of the paypoint."),
    ] = None
    paypoint_dba_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="paypointDbaName"),
        pydantic.Field(alias="paypointDbaName", description="The DBA name of the paypoint."),
    ] = None
    paypoint_logo: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="paypointLogo"),
        pydantic.Field(alias="paypointLogo", description="URL to the paypoint's logo."),
    ] = None
    parent_org_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="parentOrgName"),
        pydantic.Field(alias="parentOrgName", description="The name of the parent organization."),
    ] = None
    parent_org_id: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="parentOrgId"),
        pydantic.Field(alias="parentOrgId", description="The ID of the parent organization."),
    ] = None
    parent_org_logo: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="parentOrgLogo"),
        pydantic.Field(alias="parentOrgLogo", description="URL to the parent organization's logo."),
    ] = None
    parent_org_entry_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="parentOrgEntryName"),
        pydantic.Field(alias="parentOrgEntryName", description="The entry name for the parent organization."),
    ] = None
    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="externalPaypointID"),
        pydantic.Field(alias="externalPaypointID", description="External identifier for the paypoint."),
    ] = None
    bank_account: typing_extensions.Annotated[
        typing.Optional[TransferOutBankAccount],
        FieldMetadata(alias="bankAccount"),
        pydantic.Field(alias="bankAccount", description="Bank account information for the transfer."),
    ] = None
    transfer_date: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="transferDate"),
        pydantic.Field(alias="transferDate", description="The date of the transfer."),
    ] = None
    processor: typing.Optional[str] = pydantic.Field(default=None)
    """
    The processor used for the transfer.
    """

    transfer_status: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="transferStatus"),
        pydantic.Field(alias="transferStatus", description="The status of the transfer."),
    ] = None
    gross_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="grossAmount"),
        pydantic.Field(alias="grossAmount", description="The gross amount of the transfer."),
    ] = None
    charge_back_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="chargeBackAmount"),
        pydantic.Field(alias="chargeBackAmount", description="The chargeback amount deducted from the transfer."),
    ] = None
    returned_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="returnedAmount"),
        pydantic.Field(alias="returnedAmount", description="The returned amount deducted from the transfer."),
    ] = None
    hold_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="holdAmount"),
        pydantic.Field(alias="holdAmount", description="The amount being held."),
    ] = None
    released_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="releasedAmount"),
        pydantic.Field(alias="releasedAmount", description="The amount that has been released."),
    ] = None
    billing_fees_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="billingFeesAmount"),
        pydantic.Field(alias="billingFeesAmount", description="The billing fees amount."),
    ] = None
    third_party_paid_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="thirdPartyPaidAmount"),
        pydantic.Field(alias="thirdPartyPaidAmount", description="The third party paid amount."),
    ] = None
    adjustments_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="adjustmentsAmount"),
        pydantic.Field(alias="adjustmentsAmount", description="The adjustments amount."),
    ] = None
    net_transfer_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="netTransferAmount"),
        pydantic.Field(alias="netTransferAmount", description="The net transfer amount after all deductions."),
    ] = None
    split_amount: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="splitAmount"),
        pydantic.Field(alias="splitAmount", description="The split funding amount."),
    ] = None
    events_data: typing_extensions.Annotated[
        typing.Optional[typing.List[TransferOutEventData]],
        FieldMetadata(alias="eventsData"),
        pydantic.Field(alias="eventsData", description="List of events associated with the transfer."),
    ] = None
    messages: typing.Optional[typing.List[TransferOutMessage]] = pydantic.Field(default=None)
    """
    List of messages associated with the transfer.
    """

    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
