# -*- 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 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):
        """Constructor for the IncentiveDetails class"""

        # 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):
        """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
        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 (f'{self.__class__.__name__}('
                f'incentive_type={(self.incentive_type if hasattr(self, "incentive_type") else None)!r}, '
                f'incentive_code={(self.incentive_code if hasattr(self, "incentive_code") else None)!r}, '
                f'incentive_amount={(self.incentive_amount if hasattr(self, "incentive_amount") else None)!r}, '
                f'incentive_program_code={(self.incentive_program_code if hasattr(self, "incentive_program_code") else None)!r})')

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