# 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 .authcode import Authcode
from .order_id import OrderId


class QueryResponseData(UniversalBaseModel):
    """
    The transaction's response data.
    """

    authcode: typing.Optional[Authcode] = None
    avsresponse: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text code describing the result for address validation (applies only for card transactions).
    """

    avsresponse_text: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text code describing the result for address validation (applies only for card transactions).
    """

    cvvresponse: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text code describing the result for CVV validation (applies only for card transactions).
    """

    cvvresponse_text: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text code describing the result for CVV validation (applies only for card transactions).
    """

    emv_auth_response_data: typing.Optional[str] = pydantic.Field(default=None)
    """
    EMV authorization response data, applicable for card transactions.
    """

    orderid: typing.Optional[OrderId] = None
    response: typing.Optional[str] = pydantic.Field(default=None)
    """
    Response text for operation: 'Success' or 'Declined'.
    """

    response_code: typing.Optional[str] = pydantic.Field(default=None)
    """
    Internal result code processing the transaction. Value 1 indicates successful operation, values 2 and 3 indicate errors.
    """

    response_code_text: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text describing the result. If resultCode = 1, will return 'Approved' or a general success message. If resultCode = 2 or 3, will contain the cause of the decline.
    """

    responsetext: typing.Optional[str] = pydantic.Field(default=None)
    """
    Text describing the result. If resultCode = 1, will return 'Approved' or a general success message. If resultCode = 2 or 3, will contain the cause of the decline.
    """

    transactionid: typing.Optional[str] = pydantic.Field(default=None)
    """
    The transaction identifier in Payabli.
    """

    type: typing.Optional[str] = pydantic.Field(default=None)
    """
    Type of transaction or operation.
    """

    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
