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

"""
paypalserversdk

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


class TaxesOverride(object):

    """Implementation of the 'Taxes Override' model.

    The tax details.

    Attributes:
        percentage (str): The percentage, as a fixed-point, signed decimal
            number. For example, define a 19.99% interest rate as `19.99`.
        inclusive (bool): Indicates whether the tax was already included in
            the billing amount.

    """

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

    _optionals = [
        'percentage',
        'inclusive',
    ]

    def __init__(self,
                 percentage=APIHelper.SKIP,
                 inclusive=APIHelper.SKIP):
        """Constructor for the TaxesOverride class"""

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

    @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
        percentage = dictionary.get("percentage") if dictionary.get("percentage") else APIHelper.SKIP
        inclusive = dictionary.get("inclusive") if "inclusive" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(percentage,
                   inclusive)

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

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