# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from stripe.v2._amount import Amount
from typing import ClassVar, Optional
from typing_extensions import Literal


class TransactionEntry(StripeObject):
    """
    TransactionEntries represent individual money movements across different states within a Transaction.
    """

    OBJECT_NAME: ClassVar[Literal["v2.money_management.transaction_entry"]] = (
        "v2.money_management.transaction_entry"
    )

    class BalanceImpact(StripeObject):
        available: Amount
        """
        Impact to the available balance.
        """
        inbound_pending: Amount
        """
        Impact to the inbound_pending balance.
        """
        outbound_pending: Amount
        """
        Impact to the outbound_pending balance.
        """

    class TransactionDetails(StripeObject):
        class Flow(StripeObject):
            account: Optional[str]
            """
            If applicable, the connected account associated with this Transaction's flow.
            """
            adjustment: Optional[str]
            """
            If applicable, the ID of the Adjustment that created this Transaction.
            """
            application_fee: Optional[str]
            """
            If applicable, the ID of the Application Fee that created this Transaction.
            """
            application_fee_refund: Optional[str]
            """
            If applicable, the ID of the Application Fee Refund that created this Transaction.
            """
            charge: Optional[str]
            """
            If applicable, the ID of the Charge that created this Transaction.
            """
            currency_conversion: Optional[str]
            """
            In the future, this will be the ID of the currency conversion that created this Transaction. For now, this field is always null.
            """
            debit_dispute: Optional[str]
            """
            If applicable, the ID of the DebitDispute that created this Transaction.
            """
            dispute: Optional[str]
            """
            If applicable, the ID of the Dispute that created this Transaction.
            """
            fee_transaction: Optional[str]
            """
            If applicable, the ID of the FeeTransaction that created this Transaction.
            """
            inbound_transfer: Optional[str]
            """
            If applicable, the ID of the InboundTransfer that created this Transaction.
            """
            issuing_authorization: Optional[str]
            """
            If applicable, the ID of the Issuing authorization that created this Transaction.
            """
            issuing_dispute: Optional[str]
            """
            If applicable, the ID of the Issuing dispute that created this Transaction.
            """
            issuing_transaction: Optional[str]
            """
            If applicable, the ID of the Issuing transaction that created this Transaction.
            """
            outbound_payment: Optional[str]
            """
            If applicable, the ID of the OutboundPayment that created this Transaction.
            """
            outbound_transfer: Optional[str]
            """
            If applicable, the ID of the OutboundTransfer that created this Transaction.
            """
            payout: Optional[str]
            """
            If applicable, the ID of the Payout that created this Transaction.
            """
            received_credit: Optional[str]
            """
            If applicable, the ID of the ReceivedCredit that created this Transaction.
            """
            received_debit: Optional[str]
            """
            If applicable, the ID of the ReceivedDebit that created this Transaction.
            """
            refund: Optional[str]
            """
            If applicable, the ID of the Refund that created this Transaction.
            """
            reserve_hold: Optional[str]
            """
            If applicable, the ID of the Reserve Hold that created this Transaction.
            """
            reserve_release: Optional[str]
            """
            If applicable, the ID of the Reserve Release that created this Transaction.
            """
            tax_fund: Optional[str]
            """
            If applicable, the ID of the TaxFund that created this Transaction.
            """
            topup: Optional[str]
            """
            If applicable, the ID of the Topup that created this Transaction.
            """
            transfer: Optional[str]
            """
            If applicable, the ID of the Transfer that created this Transaction.
            """
            transfer_reversal: Optional[str]
            """
            If applicable, the ID of the Transfer Reversal that created this Transaction.
            """
            treasury_credit_reversal: Optional[str]
            """
            If applicable, the ID of the Treasury CreditReversal that created this Transaction.
            """
            treasury_debit_reversal: Optional[str]
            """
            If applicable, the ID of the Treasury DebitReversal that created this Transaction.
            """
            treasury_inbound_transfer: Optional[str]
            """
            If applicable, the ID of the Treasury InboundTransfer that created this Transaction.
            """
            treasury_issuing_authorization: Optional[str]
            """
            If applicable, the ID of the Treasury IssuingAuthorization that created this Transaction.
            """
            treasury_outbound_payment: Optional[str]
            """
            If applicable, the ID of the Treasury OutboundPayment that created this Transaction.
            """
            treasury_outbound_transfer: Optional[str]
            """
            If applicable, the ID of the Treasury OutboundTransfer that created this Transaction.
            """
            treasury_received_credit: Optional[str]
            """
            If applicable, the ID of the Treasury ReceivedCredit that created this Transaction.
            """
            treasury_received_debit: Optional[str]
            """
            If applicable, the ID of the Treasury ReceivedDebit that created this Transaction.
            """
            type: Literal[
                "adjustment",
                "application_fee",
                "application_fee_refund",
                "charge",
                "currency_conversion",
                "debit_dispute",
                "dispute",
                "fee_transaction",
                "inbound_transfer",
                "issuing_authorization",
                "issuing_dispute",
                "issuing_transaction",
                "outbound_payment",
                "outbound_transfer",
                "payout",
                "received_credit",
                "received_debit",
                "refund",
                "reserve_hold",
                "reserve_release",
                "tax_fund",
                "topup",
                "transfer",
                "transfer_reversal",
                "treasury_credit_reversal",
                "treasury_debit_reversal",
                "treasury_inbound_transfer",
                "treasury_issuing_authorization",
                "treasury_other",
                "treasury_outbound_payment",
                "treasury_outbound_transfer",
                "treasury_received_credit",
                "treasury_received_debit",
            ]
            """
            Open Enum. Type of the flow that created the Transaction. The field matching this value will contain the ID of the flow.
            """

        category: Literal[
            "adjustment",
            "advance",
            "anticipation_repayment",
            "balance_transfer",
            "climate_order_purchase",
            "climate_order_refund",
            "connect_collection_transfer",
            "connect_reserved_funds",
            "contribution",
            "currency_conversion",
            "debit_dispute",
            "dispute",
            "dispute_reversal",
            "financing_paydown",
            "financing_paydown_reversal",
            "inbound_payment",
            "inbound_payment_failure",
            "inbound_transfer",
            "inbound_transfer_reversal",
            "india_mdr_processing_fee",
            "issuing_authorization",
            "issuing_dispute",
            "issuing_dispute_fraud_liability_debit",
            "issuing_dispute_provisional_credit",
            "issuing_dispute_provisional_credit_reversal",
            "issuing_transaction",
            "minimum_balance_hold",
            "network_cost",
            "obligation",
            "outbound_payment",
            "outbound_payment_reversal",
            "outbound_transfer",
            "outbound_transfer_reversal",
            "partial_capture_reversal",
            "payment_method_passthrough_fee",
            "payment_network_reserved_funds",
            "platform_earning",
            "platform_earning_refund",
            "platform_fee",
            "platform_funded_credit_transaction",
            "received_credit",
            "received_credit_reversal",
            "received_debit",
            "received_debit_reversal",
            "refund",
            "refund_failure",
            "risk_reserved_funds",
            "stripe_balance_payment_debit",
            "stripe_balance_payment_debit_reversal",
            "stripe_fee",
            "stripe_fee_tax",
            "tax_fund",
            "tax_withholding",
            "transfer_reversal",
            "unreconciled_customer_funds",
        ]
        """
        Closed Enum for now, and will be turned into an Open Enum soon. A descriptive category used to classify the Transaction.
        """
        financial_account: str
        """
        Indicates the FinancialAccount affected by this Transaction.
        """
        flow: Optional[Flow]
        """
        Details about the Flow object that created the Transaction.
        """
        _inner_class_types = {"flow": Flow}

    balance_impact: BalanceImpact
    """
    The delta to the FinancialAccount's balance.
    """
    created: str
    """
    Time at which the object was created.
    """
    effective_at: str
    """
    Time at which the entry impacted (or will impact if it's in the future) the FinancialAccount balance.
    """
    id: str
    """
    Unique identifier for the object.
    """
    livemode: bool
    """
    Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    """
    object: Literal["v2.money_management.transaction_entry"]
    """
    String representing the object's type. Objects of the same type share the same value of the object field.
    """
    transaction: str
    """
    The Transaction that this TransactionEntry belongs to.
    """
    transaction_details: TransactionDetails
    """
    Details copied from the transaction that this TransactionEntry belongs to.
    """
    treasury_transaction_entry: Optional[str]
    """
    The v1 Treasury transaction entry associated with this transaction entry.
    """
    _inner_class_types = {
        "balance_impact": BalanceImpact,
        "transaction_details": TransactionDetails,
    }
