# -*- coding: utf-8 -*-

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.money import Money


class TaxAmount(object):

    """Implementation of the 'Tax Amount' model.

    The tax levied by a government on the purchase of goods or services.

    Attributes:
        tax_amount (Money): The currency and amount for a financial
            transaction, such as a balance or payment due.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "tax_amount": 'tax_amount'
    }

    _optionals = [
        'tax_amount',
    ]

    def __init__(self,
                 tax_amount=APIHelper.SKIP):
        """Constructor for the TaxAmount class"""

        # Initialize members of the class
        if tax_amount is not APIHelper.SKIP:
            self.tax_amount = tax_amount 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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
        tax_amount = Money.from_dictionary(dictionary.get('tax_amount')) if 'tax_amount' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(tax_amount)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'tax_amount={(self.tax_amount if hasattr(self, "tax_amount") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'tax_amount={(self.tax_amount if hasattr(self, "tax_amount") else None)!s})')
