"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.money import Money


class IncentiveDetails(object):
    """Implementation of the 'Incentive Details' model.

    The incentive details.

    Attributes:
        incentive_type (str): The type of incentive, such as a special offer or
            coupon.
        incentive_code (str): The code that identifies an incentive, such as a coupon.
        incentive_amount (Money): The currency and amount for a financial
            transaction, such as a balance or payment due.
        incentive_program_code (str): The incentive program code that identifies a
            merchant loyalty or incentive program.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "incentive_type": "incentive_type",
        "incentive_code": "incentive_code",
        "incentive_amount": "incentive_amount",
        "incentive_program_code": "incentive_program_code",
    }

    _optionals = [
        "incentive_type",
        "incentive_code",
        "incentive_amount",
        "incentive_program_code",
    ]

    def __init__(
        self,
        incentive_type=APIHelper.SKIP,
        incentive_code=APIHelper.SKIP,
        incentive_amount=APIHelper.SKIP,
        incentive_program_code=APIHelper.SKIP):
        """Initialize a IncentiveDetails instance."""
        # Initialize members of the class
        if incentive_type is not APIHelper.SKIP:
            self.incentive_type = incentive_type
        if incentive_code is not APIHelper.SKIP:
            self.incentive_code = incentive_code
        if incentive_amount is not APIHelper.SKIP:
            self.incentive_amount = incentive_amount
        if incentive_program_code is not APIHelper.SKIP:
            self.incentive_program_code = incentive_program_code

    @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
        incentive_type =\
            dictionary.get("incentive_type")\
            if dictionary.get("incentive_type")\
                else APIHelper.SKIP
        incentive_code =\
            dictionary.get("incentive_code")\
            if dictionary.get("incentive_code")\
                else APIHelper.SKIP
        incentive_amount =\
            Money.from_dictionary(
                dictionary.get("incentive_amount"))\
                if "incentive_amount" in dictionary.keys()\
                else APIHelper.SKIP
        incentive_program_code =\
            dictionary.get("incentive_program_code")\
            if dictionary.get("incentive_program_code")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(incentive_type,
                   incentive_code,
                   incentive_amount,
                   incentive_program_code)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _incentive_type=(
            self.incentive_type
            if hasattr(self, "incentive_type")
            else None
        )
        _incentive_code=(
            self.incentive_code
            if hasattr(self, "incentive_code")
            else None
        )
        _incentive_amount=(
            self.incentive_amount
            if hasattr(self, "incentive_amount")
            else None
        )
        _incentive_program_code=(
            self.incentive_program_code
            if hasattr(self, "incentive_program_code")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"incentive_type={_incentive_type!r}, "
            f"incentive_code={_incentive_code!r}, "
            f"incentive_amount={_incentive_amount!r}, "
            f"incentive_program_code={_incentive_program_code!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _incentive_type=(
            self.incentive_type
            if hasattr(self, "incentive_type")
            else None
        )
        _incentive_code=(
            self.incentive_code
            if hasattr(self, "incentive_code")
            else None
        )
        _incentive_amount=(
            self.incentive_amount
            if hasattr(self, "incentive_amount")
            else None
        )
        _incentive_program_code=(
            self.incentive_program_code
            if hasattr(self, "incentive_program_code")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"incentive_type={_incentive_type!s}, "
            f"incentive_code={_incentive_code!s}, "
            f"incentive_amount={_incentive_amount!s}, "
            f"incentive_program_code={_incentive_program_code!s}, "
            f")"
        )
