# -*- 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 PricingScheme(object):

    """Implementation of the 'Pricing Scheme' model.

    The pricing scheme details.

    Attributes:
        price (Money): The currency and amount for a financial transaction,
            such as a balance or payment due.
        pricing_model (PricingModel): The pricing model for the billing cycle.
        reload_threshold_amount (Money): The currency and amount for a
            financial transaction, such as a balance or payment due.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "pricing_model": 'pricing_model',
        "price": 'price',
        "reload_threshold_amount": 'reload_threshold_amount'
    }

    _optionals = [
        'price',
        'reload_threshold_amount',
    ]

    def __init__(self,
                 pricing_model=None,
                 price=APIHelper.SKIP,
                 reload_threshold_amount=APIHelper.SKIP):
        """Constructor for the PricingScheme class"""

        # Initialize members of the class
        if price is not APIHelper.SKIP:
            self.price = price 
        self.pricing_model = pricing_model 
        if reload_threshold_amount is not APIHelper.SKIP:
            self.reload_threshold_amount = reload_threshold_amount 

    @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
        pricing_model = dictionary.get("pricing_model") if dictionary.get("pricing_model") else None
        price = Money.from_dictionary(dictionary.get('price')) if 'price' in dictionary.keys() else APIHelper.SKIP
        reload_threshold_amount = Money.from_dictionary(dictionary.get('reload_threshold_amount')) if 'reload_threshold_amount' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(pricing_model,
                   price,
                   reload_threshold_amount)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'price={(self.price if hasattr(self, "price") else None)!r}, '
                f'pricing_model={self.pricing_model!r}, '
                f'reload_threshold_amount={(self.reload_threshold_amount if hasattr(self, "reload_threshold_amount") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'price={(self.price if hasattr(self, "price") else None)!s}, '
                f'pricing_model={self.pricing_model!s}, '
                f'reload_threshold_amount={(self.reload_threshold_amount if hasattr(self, "reload_threshold_amount") else None)!s})')
