"""visaacceptancemergedspec.

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

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


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

    Attributes:
        total_amount (str): Grand total for the order. This value cannot be negative.
            You can include a decimal point (.), but you cannot include any other
            special characters. Visa Acceptance truncates the amount to the correct
            number of decimal places
        currency (str): Currency used for the order
        discount_amount (str): Discount amount for the transaction.
        shipping_amount (str): Aggregate shipping charges for the transactions.
        shipping_discount_amount (str): Shipping discount amount for the transaction.
        tax_amount (str): Total tax amount.
        insurance_amount (str): Amount being charged for the insurance fee.
        duty_amount (str): Amount being charged as duty amount.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "total_amount": "totalAmount",
        "currency": "currency",
        "discount_amount": "discountAmount",
        "shipping_amount": "shippingAmount",
        "shipping_discount_amount": "shippingDiscountAmount",
        "tax_amount": "taxAmount",
        "insurance_amount": "insuranceAmount",
        "duty_amount": "dutyAmount",
    }

    _optionals = [
        "total_amount",
        "currency",
        "discount_amount",
        "shipping_amount",
        "shipping_discount_amount",
        "tax_amount",
        "insurance_amount",
        "duty_amount",
    ]

    def __init__(
        self,
        total_amount=APIHelper.SKIP,
        currency=APIHelper.SKIP,
        discount_amount=APIHelper.SKIP,
        shipping_amount=APIHelper.SKIP,
        shipping_discount_amount=APIHelper.SKIP,
        tax_amount=APIHelper.SKIP,
        insurance_amount=APIHelper.SKIP,
        duty_amount=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a AmountDetails32 instance."""
        # Initialize members of the class
        if total_amount is not APIHelper.SKIP:
            self.total_amount = total_amount
        if currency is not APIHelper.SKIP:
            self.currency = currency
        if discount_amount is not APIHelper.SKIP:
            self.discount_amount = discount_amount
        if shipping_amount is not APIHelper.SKIP:
            self.shipping_amount = shipping_amount
        if shipping_discount_amount is not APIHelper.SKIP:
            self.shipping_discount_amount = shipping_discount_amount
        if tax_amount is not APIHelper.SKIP:
            self.tax_amount = tax_amount
        if insurance_amount is not APIHelper.SKIP:
            self.insurance_amount = insurance_amount
        if duty_amount is not APIHelper.SKIP:
            self.duty_amount = duty_amount

        # 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
        total_amount =\
            dictionary.get("totalAmount")\
            if dictionary.get("totalAmount")\
                else APIHelper.SKIP
        currency =\
            dictionary.get("currency")\
            if dictionary.get("currency")\
                else APIHelper.SKIP
        discount_amount =\
            dictionary.get("discountAmount")\
            if dictionary.get("discountAmount")\
                else APIHelper.SKIP
        shipping_amount =\
            dictionary.get("shippingAmount")\
            if dictionary.get("shippingAmount")\
                else APIHelper.SKIP
        shipping_discount_amount =\
            dictionary.get("shippingDiscountAmount")\
            if dictionary.get("shippingDiscountAmount")\
                else APIHelper.SKIP
        tax_amount =\
            dictionary.get("taxAmount")\
            if dictionary.get("taxAmount")\
                else APIHelper.SKIP
        insurance_amount =\
            dictionary.get("insuranceAmount")\
            if dictionary.get("insuranceAmount")\
                else APIHelper.SKIP
        duty_amount =\
            dictionary.get("dutyAmount")\
            if dictionary.get("dutyAmount")\
                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(total_amount,
                   currency,
                   discount_amount,
                   shipping_amount,
                   shipping_discount_amount,
                   tax_amount,
                   insurance_amount,
                   duty_amount,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _total_amount=(
            self.total_amount
            if hasattr(self, "total_amount")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _discount_amount=(
            self.discount_amount
            if hasattr(self, "discount_amount")
            else None
        )
        _shipping_amount=(
            self.shipping_amount
            if hasattr(self, "shipping_amount")
            else None
        )
        _shipping_discount_amount=(
            self.shipping_discount_amount
            if hasattr(self, "shipping_discount_amount")
            else None
        )
        _tax_amount=(
            self.tax_amount
            if hasattr(self, "tax_amount")
            else None
        )
        _insurance_amount=(
            self.insurance_amount
            if hasattr(self, "insurance_amount")
            else None
        )
        _duty_amount=(
            self.duty_amount
            if hasattr(self, "duty_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"total_amount={_total_amount!r}, "
            f"currency={_currency!r}, "
            f"discount_amount={_discount_amount!r}, "
            f"shipping_amount={_shipping_amount!r}, "
            f"shipping_discount_amount={_shipping_discount_amount!r}, "
            f"tax_amount={_tax_amount!r}, "
            f"insurance_amount={_insurance_amount!r}, "
            f"duty_amount={_duty_amount!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _total_amount=(
            self.total_amount
            if hasattr(self, "total_amount")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _discount_amount=(
            self.discount_amount
            if hasattr(self, "discount_amount")
            else None
        )
        _shipping_amount=(
            self.shipping_amount
            if hasattr(self, "shipping_amount")
            else None
        )
        _shipping_discount_amount=(
            self.shipping_discount_amount
            if hasattr(self, "shipping_discount_amount")
            else None
        )
        _tax_amount=(
            self.tax_amount
            if hasattr(self, "tax_amount")
            else None
        )
        _insurance_amount=(
            self.insurance_amount
            if hasattr(self, "insurance_amount")
            else None
        )
        _duty_amount=(
            self.duty_amount
            if hasattr(self, "duty_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"total_amount={_total_amount!s}, "
            f"currency={_currency!s}, "
            f"discount_amount={_discount_amount!s}, "
            f"shipping_amount={_shipping_amount!s}, "
            f"shipping_discount_amount={_shipping_discount_amount!s}, "
            f"tax_amount={_tax_amount!s}, "
            f"insurance_amount={_insurance_amount!s}, "
            f"duty_amount={_duty_amount!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
