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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .v_2_response_action import V2ResponseAction
from .v_2_response_code import V2ResponseCode
from .v_2_response_explanation import V2ResponseExplanation
from .v_2_response_reason import V2ResponseReason
from .v_2_transaction_details import V2TransactionDetails


class V2TransactionResponseWrapper(UniversalBaseModel):
    """
    Standard response wrapper for v2 Money In transaction endpoints. All v2 transaction endpoints return responses in this format with consistent `code`, `reason`, `explanation`, and `action` fields. The `data` field contains transaction details.
    """

    code: V2ResponseCode
    reason: V2ResponseReason
    explanation: V2ResponseExplanation
    action: V2ResponseAction
    data: V2TransactionDetails
    token: typing.Optional[str] = pydantic.Field(default=None)
    """
    Pagination token (equivalent to `pageIdentifier` in v1 APIs). Returns `null` when pagination is not applicable.
    """

    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
