"""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.incentive_details import (
    IncentiveDetails,
)


class IncentiveInformation(object):
    """Implementation of the 'Incentive Information' model.

    The incentive details.

    Attributes:
        incentive_details (List[IncentiveDetails]): An array of incentive details.

    """

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

    _optionals = [
        "incentive_details",
    ]

    def __init__(
        self,
        incentive_details=APIHelper.SKIP):
        """Initialize a IncentiveInformation instance."""
        # Initialize members of the class
        if incentive_details is not APIHelper.SKIP:
            self.incentive_details = incentive_details

    @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_details = None
        if dictionary.get("incentive_details") is not None:
            incentive_details = [
                IncentiveDetails.from_dictionary(x)
                    for x in dictionary.get("incentive_details")
            ]
        else:
            incentive_details = APIHelper.SKIP

        # Return an object of this model
        return cls(incentive_details)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _incentive_details=(
            self.incentive_details
            if hasattr(self, "incentive_details")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"incentive_details={_incentive_details!r}, "
            f")"
        )

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