# 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.authcode import Authcode
from ...types.avs_response import AvsResponse
from ...types.avs_response_text import AvsResponseText
from ...types.customer_vault_id import CustomerVaultId
from ...types.cvv_response import CvvResponse
from ...types.cvv_response_text import CvvResponseText
from ...types.emv_auth_response_data import EmvAuthResponseData
from ...types.order_id import OrderId
from ...types.result_code_text import ResultCodeText
from ...types.result_codev_2 import ResultCodev2
from ...types.resulttext import Resulttext


class V2TransactionDetailResponseData(UniversalBaseModel):
    """
    Response data from payment processor

    Examples
    --------
    from payabli.v_2_money_in_types import V2TransactionDetailResponseData

    V2TransactionDetailResponseData(
        result_code="A0000",
        result_code_text="Approved",
        responsetext="CAPTURED",
        authcode="AXS425",
        transactionid="TRN_Xo4dpKfmx3OxSc9svd2ccI6OOnyB2I",
        avsresponse="N",
        avsresponse_text="No Match, No address or ZIP match",
        cvvresponse="M",
        cvvresponse_text="CVV2/CVC2 match",
        response_code="100",
        response_code_text="Operation successful",
    )
    """

    result_code: typing_extensions.Annotated[
        ResultCodev2, FieldMetadata(alias="resultCode"), pydantic.Field(alias="resultCode")
    ]
    result_code_text: typing_extensions.Annotated[
        ResultCodeText, FieldMetadata(alias="resultCodeText"), pydantic.Field(alias="resultCodeText")
    ]
    response: typing.Optional[str] = None
    responsetext: Resulttext
    authcode: typing.Optional[Authcode] = None
    transactionid: str = pydantic.Field()
    """
    Unique identifier for the transaction assigned by the payment processor.
    """

    avsresponse: typing.Optional[AvsResponse] = None
    avsresponse_text: typing.Optional[AvsResponseText] = None
    cvvresponse: typing.Optional[CvvResponse] = None
    cvvresponse_text: typing.Optional[CvvResponseText] = None
    orderid: typing.Optional[OrderId] = None
    type: typing.Optional[str] = None
    response_code: str = pydantic.Field()
    """
    Processor-specific response code.
    """

    response_code_text: str = pydantic.Field()
    """
    Description of the response code.
    """

    customer_vault_id: typing.Optional[CustomerVaultId] = None
    emv_auth_response_data: typing.Optional[EmvAuthResponseData] = 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
