"""visaacceptancemergedspec.

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

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


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

    Attributes:
        refund_amount (str): Total amount of the refund.
        credit_amount (str): Amount that was credited to the cardholder’s account.
            Returned by PIN debit credit.
        currency (str): Currency used for the order. Use the three-character [ISO
            Standard Currency Codes.](  #### Used by **Authorization** Required
            field.  **Authorization Reversal** For an authorization reversal
            (`reversalInformation`) or a capture (`processingOptions.capture` is set
            to `true`), you must use the same currency that you used in your payment
            authorization request.  #### PIN Debit Currency for the amount you
            requested for the PIN debit purchase. This value is returned for partial
            authorizations. The issuing bank can approve a partial amount if the
            balance on the debit card is less than the requested transaction amount.
            For the possible values, see the [ISO Standard Currency Codes]( Returned
            by PIN debit purchase.  For PIN debit reversal requests, you must use the
            same currency that was used for the PIN debit purchase or PIN debit
            credit that you are reversing. For the possible values, see the [ISO
            Standard Currency Codes](  Required field for PIN Debit purchase and PIN
            Debit credit requests. Optional field for PIN Debit reversal requests.
            #### GPX This field is optional for reversing an authorization or credit.
            #### DCC for First Data Your local currency.  #### Tax Calculation
            Required for international tax and value added tax only. Optional for
            U.S. and Canadian taxes. Your local currency.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "refund_amount": "refundAmount",
        "credit_amount": "creditAmount",
        "currency": "currency",
    }

    _optionals = [
        "refund_amount",
        "credit_amount",
        "currency",
    ]

    def __init__(
        self,
        refund_amount=APIHelper.SKIP,
        credit_amount=APIHelper.SKIP,
        currency=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RefundAmountDetails instance."""
        # Initialize members of the class
        if refund_amount is not APIHelper.SKIP:
            self.refund_amount = refund_amount
        if credit_amount is not APIHelper.SKIP:
            self.credit_amount = credit_amount
        if currency is not APIHelper.SKIP:
            self.currency = currency

        # 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
        refund_amount =\
            dictionary.get("refundAmount")\
            if dictionary.get("refundAmount")\
                else APIHelper.SKIP
        credit_amount =\
            dictionary.get("creditAmount")\
            if dictionary.get("creditAmount")\
                else APIHelper.SKIP
        currency =\
            dictionary.get("currency")\
            if dictionary.get("currency")\
                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(refund_amount,
                   credit_amount,
                   currency,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _refund_amount=(
            self.refund_amount
            if hasattr(self, "refund_amount")
            else None
        )
        _credit_amount=(
            self.credit_amount
            if hasattr(self, "credit_amount")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"refund_amount={_refund_amount!r}, "
            f"credit_amount={_credit_amount!r}, "
            f"currency={_currency!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _refund_amount=(
            self.refund_amount
            if hasattr(self, "refund_amount")
            else None
        )
        _credit_amount=(
            self.credit_amount
            if hasattr(self, "credit_amount")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"refund_amount={_refund_amount!s}, "
            f"credit_amount={_credit_amount!s}, "
            f"currency={_currency!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
