"""paypalserversdk.

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

# ruff: noqa: E501
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):
        """Initialize a TaxesOverride instance."""
        # 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):
        """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
        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 a unambiguous string representation."""
        _percentage=(
            self.percentage
            if hasattr(self, "percentage")
            else None
        )
        _inclusive=(
            self.inclusive
            if hasattr(self, "inclusive")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"percentage={_percentage!r}, "
            f"inclusive={_inclusive!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _percentage=(
            self.percentage
            if hasattr(self, "percentage")
            else None
        )
        _inclusive=(
            self.inclusive
            if hasattr(self, "inclusive")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"percentage={_percentage!s}, "
            f"inclusive={_inclusive!s}, "
            f")"
        )
