"""visaacceptancemergedspec.

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

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


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

    Attributes:
        settlement_amount (str): This is a multicurrency field. It contains the
            transaction amount (field 4), converted to the Currency used to bill the
            cardholder’s account. This field is returned for OCT transactions.
        settlement_currency (str): This is a multicurrency-only field. It contains a
            3-digit numeric code that identifies the currency used by the issuer to
            bill the cardholder's account. This field is returned for OCT
            transactions.
        exchange_rate (str): Exchange rate returned by the DCC service. Includes a
            decimal point and a maximum of 4 decimal places.
        foreign_amount (str): Set this field to the converted amount that was
            returned by the DCC provider.
        foreign_currency (str): Set this field to the converted amount that was
            returned by the DCC provider.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "settlement_amount": "settlementAmount",
        "settlement_currency": "settlementCurrency",
        "exchange_rate": "exchangeRate",
        "foreign_amount": "foreignAmount",
        "foreign_currency": "foreignCurrency",
    }

    _optionals = [
        "settlement_amount",
        "settlement_currency",
        "exchange_rate",
        "foreign_amount",
        "foreign_currency",
    ]

    def __init__(
        self,
        settlement_amount=APIHelper.SKIP,
        settlement_currency=APIHelper.SKIP,
        exchange_rate=APIHelper.SKIP,
        foreign_amount=APIHelper.SKIP,
        foreign_currency=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a AmountDetails12 instance."""
        # Initialize members of the class
        if settlement_amount is not APIHelper.SKIP:
            self.settlement_amount = settlement_amount
        if settlement_currency is not APIHelper.SKIP:
            self.settlement_currency = settlement_currency
        if exchange_rate is not APIHelper.SKIP:
            self.exchange_rate = exchange_rate
        if foreign_amount is not APIHelper.SKIP:
            self.foreign_amount = foreign_amount
        if foreign_currency is not APIHelper.SKIP:
            self.foreign_currency = foreign_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
        settlement_amount =\
            dictionary.get("settlementAmount")\
            if dictionary.get("settlementAmount")\
                else APIHelper.SKIP
        settlement_currency =\
            dictionary.get("settlementCurrency")\
            if dictionary.get("settlementCurrency")\
                else APIHelper.SKIP
        exchange_rate =\
            dictionary.get("exchangeRate")\
            if dictionary.get("exchangeRate")\
                else APIHelper.SKIP
        foreign_amount =\
            dictionary.get("foreignAmount")\
            if dictionary.get("foreignAmount")\
                else APIHelper.SKIP
        foreign_currency =\
            dictionary.get("foreignCurrency")\
            if dictionary.get("foreignCurrency")\
                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(settlement_amount,
                   settlement_currency,
                   exchange_rate,
                   foreign_amount,
                   foreign_currency,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _settlement_amount=(
            self.settlement_amount
            if hasattr(self, "settlement_amount")
            else None
        )
        _settlement_currency=(
            self.settlement_currency
            if hasattr(self, "settlement_currency")
            else None
        )
        _exchange_rate=(
            self.exchange_rate
            if hasattr(self, "exchange_rate")
            else None
        )
        _foreign_amount=(
            self.foreign_amount
            if hasattr(self, "foreign_amount")
            else None
        )
        _foreign_currency=(
            self.foreign_currency
            if hasattr(self, "foreign_currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"settlement_amount={_settlement_amount!r}, "
            f"settlement_currency={_settlement_currency!r}, "
            f"exchange_rate={_exchange_rate!r}, "
            f"foreign_amount={_foreign_amount!r}, "
            f"foreign_currency={_foreign_currency!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _settlement_amount=(
            self.settlement_amount
            if hasattr(self, "settlement_amount")
            else None
        )
        _settlement_currency=(
            self.settlement_currency
            if hasattr(self, "settlement_currency")
            else None
        )
        _exchange_rate=(
            self.exchange_rate
            if hasattr(self, "exchange_rate")
            else None
        )
        _foreign_amount=(
            self.foreign_amount
            if hasattr(self, "foreign_amount")
            else None
        )
        _foreign_currency=(
            self.foreign_currency
            if hasattr(self, "foreign_currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"settlement_amount={_settlement_amount!s}, "
            f"settlement_currency={_settlement_currency!s}, "
            f"exchange_rate={_exchange_rate!s}, "
            f"foreign_amount={_foreign_amount!s}, "
            f"foreign_currency={_foreign_currency!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
