"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


class Reward(object):
    """Implementation of the 'Reward' model.

    Rewards that will be earned by a buyer post-purchase.

    Attributes:
        amount_earned (int): Number of reward type earned, i.e. number of points.
        reward_program (str): Name of reward program that buyer is earning rewards
            with.
        reward_name (str): Name of type of reward, i.e. "Points".
        description (str): The model property of type str.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "amount_earned": "amountEarned",
        "reward_program": "rewardProgram",
        "reward_name": "rewardName",
        "description": "description",
    }

    def __init__(
        self,
        amount_earned=None,
        reward_program=None,
        reward_name=None,
        description=None,
        additional_properties=None):
        """Initialize a Reward instance."""
        # Initialize members of the class
        self.amount_earned = amount_earned
        self.reward_program = reward_program
        self.reward_name = reward_name
        self.description = description

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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
        amount_earned =\
            dictionary.get("amountEarned")\
            if dictionary.get("amountEarned")\
                else None
        reward_program =\
            dictionary.get("rewardProgram")\
            if dictionary.get("rewardProgram")\
                else None
        reward_name =\
            dictionary.get("rewardName")\
            if dictionary.get("rewardName")\
                else None
        description =\
            dictionary.get("description")\
            if dictionary.get("description")\
                else None

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(amount_earned,
                   reward_program,
                   reward_name,
                   description,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _amount_earned=self.amount_earned
        _reward_program=self.reward_program
        _reward_name=self.reward_name
        _description=self.description
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"amount_earned={_amount_earned!r}, "
            f"reward_program={_reward_program!r}, "
            f"reward_name={_reward_name!r}, "
            f"description={_description!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _amount_earned=self.amount_earned
        _reward_program=self.reward_program
        _reward_name=self.reward_name
        _description=self.description
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"amount_earned={_amount_earned!s}, "
            f"reward_program={_reward_program!s}, "
            f"reward_name={_reward_name!s}, "
            f"description={_description!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
