# 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.billing_fee_detail import BillingFeeDetail
from .transfer_out_detail_bill import TransferOutDetailBill
from .transfer_out_detail_check_data import TransferOutDetailCheckData
from .transfer_out_detail_event import TransferOutDetailEvent
from .transfer_out_detail_payment_data import TransferOutDetailPaymentData
from .transfer_out_detail_vendor import TransferOutDetailVendor


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

    transfer_detail_id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="transferDetailId")] = (
        pydantic.Field(default=None)
    )
    """
    Unique identifier for the transfer detail.
    """

    transfer_id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="transferId")] = pydantic.Field(
        default=None
    )
    """
    The ID of the transfer this detail belongs to.
    """

    transaction_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="transactionId")] = (
        pydantic.Field(default=None)
    )
    """
    The transaction ID in Payabli's system.
    """

    id_out: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="IdOut")] = pydantic.Field(
        default=None
    )
    """
    The outbound transaction ID.
    """

    method: typing.Optional[str] = pydantic.Field(default=None)
    """
    Payment method used.
    """

    type: typing.Optional[str] = pydantic.Field(default=None)
    """
    The transaction type (credit or debit).
    """

    category: typing.Optional[str] = pydantic.Field(default=None)
    """
    Category of the transaction detail.
    """

    gross_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="grossAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The gross amount of the transaction.
    """

    returned_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="returnedAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Amount returned.
    """

    refund_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="refundAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Amount refunded.
    """

    hold_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="holdAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Amount being held.
    """

    released_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="releasedAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Amount released.
    """

    billing_fees_amount: typing_extensions.Annotated[
        typing.Optional[float], FieldMetadata(alias="billingFeesAmount")
    ] = pydantic.Field(default=None)
    """
    Billing fees amount.
    """

    adjustments_amount: typing_extensions.Annotated[
        typing.Optional[float], FieldMetadata(alias="adjustmentsAmount")
    ] = pydantic.Field(default=None)
    """
    Adjustments amount.
    """

    net_transfer_amount: typing_extensions.Annotated[
        typing.Optional[float], FieldMetadata(alias="netTransferAmount")
    ] = pydantic.Field(default=None)
    """
    Net transfer amount after deductions.
    """

    billing_fees_details: typing_extensions.Annotated[
        typing.Optional[typing.List[BillingFeeDetail]], FieldMetadata(alias="billingFeesDetails")
    ] = pydantic.Field(default=None)
    """
    Detailed breakdown of billing fees.
    """

    created_at: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="CreatedAt")] = pydantic.Field(
        default=None
    )
    """
    Date and time the record was created.
    """

    comments: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Comments")] = pydantic.Field(
        default=None
    )
    """
    Comments on the transfer detail.
    """

    vendor: typing_extensions.Annotated[typing.Optional[TransferOutDetailVendor], FieldMetadata(alias="Vendor")] = (
        pydantic.Field(default=None)
    )
    """
    Vendor information.
    """

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

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

    paypoint_id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="PaypointId")] = pydantic.Field(
        default=None
    )
    """
    ID of the paypoint.
    """

    status: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="Status")] = pydantic.Field(
        default=None
    )
    """
    Status of the transfer detail.
    """

    payment_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaymentId")] = pydantic.Field(
        default=None
    )
    """
    Payment ID.
    """

    trans_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="TransId")] = pydantic.Field(
        default=None
    )
    """
    Transaction ID.
    """

    trans_status: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="TransStatus")] = (
        pydantic.Field(default=None)
    )
    """
    Transaction status.
    """

    trans_status_detail: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="TransStatusDetail")] = (
        pydantic.Field(default=None)
    )
    """
    Detailed transaction status.
    """

    trans_status_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="TransStatusName")] = (
        pydantic.Field(default=None)
    )
    """
    Name of the transaction status.
    """

    trans_status_category: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="TransStatusCategory")
    ] = pydantic.Field(default=None)
    """
    Category of the transaction status.
    """

    last_updated: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="LastUpdated")] = (
        pydantic.Field(default=None)
    )
    """
    Date and time the record was last updated.
    """

    total_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="TotalAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Total amount of the transaction.
    """

    net_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="NetAmount")] = pydantic.Field(
        default=None
    )
    """
    Net amount of the transaction.
    """

    fee_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="FeeAmount")] = pydantic.Field(
        default=None
    )
    """
    Fee amount for the transaction.
    """

    source: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Source")] = pydantic.Field(
        default=None
    )
    """
    Source of the transaction.
    """

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

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

    batch_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="BatchNumber")] = (
        pydantic.Field(default=None)
    )
    """
    Batch number for the transfer.
    """

    payment_status: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaymentStatus")] = (
        pydantic.Field(default=None)
    )
    """
    Status of the payment.
    """

    payment_method: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaymentMethod")] = (
        pydantic.Field(default=None)
    )
    """
    Payment method used.
    """

    card_token: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="CardToken")] = pydantic.Field(
        default=None
    )
    """
    Token for the card used.
    """

    check_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="CheckNumber")] = (
        pydantic.Field(default=None)
    )
    """
    Check number if paid by check.
    """

    check_data: typing_extensions.Annotated[
        typing.Optional[TransferOutDetailCheckData], FieldMetadata(alias="CheckData")
    ] = pydantic.Field(default=None)
    """
    Check data if paid by check.
    """

    payment_data: typing_extensions.Annotated[
        typing.Optional[TransferOutDetailPaymentData], FieldMetadata(alias="PaymentData")
    ] = pydantic.Field(default=None)
    """
    Payment data for the transaction.
    """

    bills: typing_extensions.Annotated[
        typing.Optional[typing.List[TransferOutDetailBill]], FieldMetadata(alias="Bills")
    ] = pydantic.Field(default=None)
    """
    Bills associated with the transfer.
    """

    events: typing_extensions.Annotated[
        typing.Optional[typing.List[TransferOutDetailEvent]], FieldMetadata(alias="Events")
    ] = pydantic.Field(default=None)
    """
    Events associated with the transfer.
    """

    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="externalPaypointID")
    ] = pydantic.Field(default=None)
    """
    External paypoint ID.
    """

    entry_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="EntryName")] = pydantic.Field(
        default=None
    )
    """
    Entry name for the paypoint.
    """

    gateway: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Gateway")] = pydantic.Field(
        default=None
    )
    """
    Gateway used for the transaction.
    """

    batch_id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="BatchId")] = pydantic.Field(
        default=None
    )
    """
    ID of the batch.
    """

    has_vcard_transactions: typing_extensions.Annotated[
        typing.Optional[bool], FieldMetadata(alias="HasVcardTransactions")
    ] = pydantic.Field(default=None)
    """
    Whether the transfer has virtual card transactions.
    """

    is_same_day_ach: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="IsSameDayACH")] = (
        pydantic.Field(default=None)
    )
    """
    Whether this is a same-day ACH transaction.
    """

    schedule_id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="ScheduleId")] = pydantic.Field(
        default=None
    )
    """
    ID of the schedule if applicable.
    """

    settlement_status: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="SettlementStatus")] = (
        pydantic.Field(default=None)
    )
    """
    Settlement status.
    """

    settlement_status_name: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="SettlementStatusName")
    ] = pydantic.Field(default=None)
    """
    Name of the settlement status.
    """

    settlement_date: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="SettlementDate")] = (
        pydantic.Field(default=None)
    )
    """
    Date of settlement.
    """

    risk_flagged: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="RiskFlagged")] = (
        pydantic.Field(default=None)
    )
    """
    Whether the transaction was flagged for risk.
    """

    risk_flagged_on: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="RiskFlaggedOn")] = (
        pydantic.Field(default=None)
    )
    """
    Date and time the transaction was flagged.
    """

    risk_status: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="RiskStatus")] = pydantic.Field(
        default=None
    )
    """
    Risk status of the transaction.
    """

    risk_reason: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="RiskReason")] = pydantic.Field(
        default=None
    )
    """
    Reason for the risk flag.
    """

    risk_action: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="RiskAction")] = pydantic.Field(
        default=None
    )
    """
    Action taken for risk.
    """

    risk_action_code: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="RiskActionCode")] = (
        pydantic.Field(default=None)
    )
    """
    Code for the risk action.
    """

    payout_program: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PayoutProgram")] = (
        pydantic.Field(default=None)
    )
    """
    Payout program used.
    """

    ach_trace_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="AchTraceNumber")] = (
        pydantic.Field(default=None)
    )
    """
    ACH trace number.
    """

    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
