"""visaacceptancemergedspec.

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

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


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

    Attributes:
        approval_code (str): The authorization code returned by the processor.
        reason_code (str): Reply flag for the original transaction.
        reversal_submitted (str): Flag indicating whether a full authorization
            reversal was successfully submitted.  Possible values: - Y: The
            authorization reversal was successfully submitted. - N: The authorization
            reversal was not successfully submitted. You must send a credit request
            for a refund.  This field is supported only for **FDC Nashville Global**.
        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",
        "reason_code": "reasonCode",
        "reversal_submitted": "reversalSubmitted",
    }

    _optionals = [
        "approval_code",
        "reason_code",
        "reversal_submitted",
    ]

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

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

    def __repr__(self):
        """Return a unambiguous string representation."""
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _reversal_submitted=(
            self.reversal_submitted
            if hasattr(self, "reversal_submitted")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!r}, "
            f"reason_code={_reason_code!r}, "
            f"reversal_submitted={_reversal_submitted!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
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _reversal_submitted=(
            self.reversal_submitted
            if hasattr(self, "reversal_submitted")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!s}, "
            f"reason_code={_reason_code!s}, "
            f"reversal_submitted={_reversal_submitted!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
