"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


class ProcessorInformation16(object):
    """Implementation of the 'ProcessorInformation16' model.

    Attributes:
        approval_code (str): Authorization code. Returned only when the processor
            returns this value.  The length of this value depends on your processor.
            Returned by authorization service.  #### PIN debit Authorization code
            that is returned by the processor.  Returned by PIN debit credit.  ####
            Elavon Encrypted Account Number Program The returned value is OFFLINE.
            #### TSYS Acquiring Solutions The returned value for a successful zero
            amount authorization is 000000.
        response_code (str): For most processors, this is the error message sent
            directly from the bank. Returned only when the processor returns this
            value.  **Important** Do not use this field to evaluate the result of the
            authorization. #### SEPA/BACS Response code from the processor. Possible
            values: 00000–99999. See Appendix C, "Reason Codes and Processor Response
            Codes," on page 42.  #### PIN debit Response value that is returned by
            the processor or bank. **Important** Do not use this field to evaluate
            the results of the transaction request.  Returned by PIN debit credit,
            PIN debit purchase, and PIN debit reversal.  #### AIBMS If this value is
            `08`, you can accept the transaction if the customer provides you with
            identification.  #### Atos This value is the response code sent from Atos
            and it might also include the response code from the bank. Format:
            `aa,bb` with the two values separated by a comma and where: - `aa` is the
            two-digit error message from Atos. - `bb` is the optional two-digit error
            message from the bank.  #### Comercio Latino This value is the status
            code and the error or response code received from the processor separated
            by a colon. Format: [status code]:E[error code] or [status
            code]:R[response code] Example `2:R06`  #### JCN Gateway
            Processor-defined detail error code. The associated response category
            code is in the `processorInformation.responseCategoryCode` field. String
            (3)
        transaction_id (str): Transaction ID assigned by the processor.
        response_details (str): Response code indicating that creating the agreement
            failed
        reason_code (str): Numeric value corresponding to the result of the request.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "approval_code": "approvalCode",
        "response_code": "responseCode",
        "transaction_id": "transactionId",
        "response_details": "responseDetails",
        "reason_code": "reasonCode",
    }

    _optionals = [
        "approval_code",
        "response_code",
        "transaction_id",
        "response_details",
        "reason_code",
    ]

    def __init__(
        self,
        approval_code=APIHelper.SKIP,
        response_code=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        response_details=APIHelper.SKIP,
        reason_code=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ProcessorInformation16 instance."""
        # Initialize members of the class
        if approval_code is not APIHelper.SKIP:
            self.approval_code = approval_code
        if response_code is not APIHelper.SKIP:
            self.response_code = response_code
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if response_details is not APIHelper.SKIP:
            self.response_details = response_details
        if reason_code is not APIHelper.SKIP:
            self.reason_code = reason_code

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        approval_code =\
            dictionary.get("approvalCode")\
            if dictionary.get("approvalCode")\
                else APIHelper.SKIP
        response_code =\
            dictionary.get("responseCode")\
            if dictionary.get("responseCode")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else APIHelper.SKIP
        response_details =\
            dictionary.get("responseDetails")\
            if dictionary.get("responseDetails")\
                else APIHelper.SKIP
        reason_code =\
            dictionary.get("reasonCode")\
            if dictionary.get("reasonCode")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(approval_code,
                   response_code,
                   transaction_id,
                   response_details,
                   reason_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _response_details=(
            self.response_details
            if hasattr(self, "response_details")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!r}, "
            f"response_code={_response_code!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"response_details={_response_details!r}, "
            f"reason_code={_reason_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _response_details=(
            self.response_details
            if hasattr(self, "response_details")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!s}, "
            f"response_code={_response_code!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"response_details={_response_details!s}, "
            f"reason_code={_reason_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
