"""visaacceptancemergedspec.

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

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


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

    Attributes:
        name (str): Name of the Processor.
        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.  #### 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)  #### paypalgateway Processor generated ID for the itemized detail.
        reason_code (str): Indicates the reason why a request succeeded or failed and
            possible action to take if a request fails.  For details, see the
            appendix of reason codes in the documentation for the relevant payment
            method.
        sequence (str): The order in which the transaction was routed to the processor
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": "name",
        "response_code": "responseCode",
        "reason_code": "reasonCode",
        "sequence": "sequence",
    }

    _optionals = [
        "name",
        "response_code",
        "reason_code",
        "sequence",
    ]

    def __init__(
        self,
        name=APIHelper.SKIP,
        response_code=APIHelper.SKIP,
        reason_code=APIHelper.SKIP,
        sequence=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MultiProcessorRouting instance."""
        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name
        if response_code is not APIHelper.SKIP:
            self.response_code = response_code
        if reason_code is not APIHelper.SKIP:
            self.reason_code = reason_code
        if sequence is not APIHelper.SKIP:
            self.sequence = sequence

        # 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
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else APIHelper.SKIP
        response_code =\
            dictionary.get("responseCode")\
            if dictionary.get("responseCode")\
                else APIHelper.SKIP
        reason_code =\
            dictionary.get("reasonCode")\
            if dictionary.get("reasonCode")\
                else APIHelper.SKIP
        sequence =\
            dictionary.get("sequence")\
            if dictionary.get("sequence")\
                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(name,
                   response_code,
                   reason_code,
                   sequence,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _sequence=(
            self.sequence
            if hasattr(self, "sequence")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"response_code={_response_code!r}, "
            f"reason_code={_reason_code!r}, "
            f"sequence={_sequence!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _sequence=(
            self.sequence
            if hasattr(self, "sequence")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!s}, "
            f"response_code={_response_code!s}, "
            f"reason_code={_reason_code!s}, "
            f"sequence={_sequence!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
