"""visaacceptancemergedspec.

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

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


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

    Attributes:
        reason (str): The reason of the status.  Possible values:   - AVS_FAILED   -
            CONTACT_PROCESSOR   - EXPIRED_CARD   - PROCESSOR_DECLINED   -
            INSUFFICIENT_FUND   - STOLEN_LOST_CARD   - ISSUER_UNAVAILABLE   -
            UNAUTHORIZED_CARD   - CVN_NOT_MATCH   - EXCEEDS_CREDIT_LIMIT   -
            INVALID_CVN   - BLOCKED_BY_CARDHOLDER   - BLACKLISTED_CUSTOMER   -
            SUSPENDED_ACCOUNT   - PAYMENT_REFUSED   - CV_FAILED   - INVALID_ACCOUNT
            - GENERAL_DECLINE   - INVALID_MERCHANT_CONFIGURATION   -
            DECISION_PROFILE_REJECT   - SCORE_EXCEEDS_THRESHOLD   -
            CONSUMER_AUTHENTICATION_REQUIRED   - ALLOWABLE_PIN_RETRIES_EXCEEDED   -
            PROCESSOR_ERROR
        message (str): The detail message related to the status and reason listed
            above.
        details (List[Detail]): The model property of type List[Detail].
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reason": "reason",
        "message": "message",
        "details": "details",
    }

    _optionals = [
        "reason",
        "message",
        "details",
    ]

    def __init__(
        self,
        reason=APIHelper.SKIP,
        message=APIHelper.SKIP,
        details=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ErrorInformation1 instance."""
        # Initialize members of the class
        if reason is not APIHelper.SKIP:
            self.reason = reason
        if message is not APIHelper.SKIP:
            self.message = message
        if details is not APIHelper.SKIP:
            self.details = details

        # 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
        reason =\
            dictionary.get("reason")\
            if dictionary.get("reason")\
                else APIHelper.SKIP
        message =\
            dictionary.get("message")\
            if dictionary.get("message")\
                else APIHelper.SKIP
        details = None
        if dictionary.get("details") is not None:
            details = [
                Detail.from_dictionary(x)
                    for x in dictionary.get("details")
            ]
        else:
            details = 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(reason,
                   message,
                   details,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _reason=(
            self.reason
            if hasattr(self, "reason")
            else None
        )
        _message=(
            self.message
            if hasattr(self, "message")
            else None
        )
        _details=(
            self.details
            if hasattr(self, "details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reason={_reason!r}, "
            f"message={_message!r}, "
            f"details={_details!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _reason=(
            self.reason
            if hasattr(self, "reason")
            else None
        )
        _message=(
            self.message
            if hasattr(self, "message")
            else None
        )
        _details=(
            self.details
            if hasattr(self, "details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reason={_reason!s}, "
            f"message={_message!s}, "
            f"details={_details!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
