# -*- coding: utf-8 -*-

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.models.money import Money


class CaptureSubscriptionRequest(object):

    """Implementation of the 'Capture Subscription Request' model.

    The charge amount from the subscriber.

    Attributes:
        note (str): The reason or note for the subscription charge.
        capture_type (CaptureType): The type of capture.
        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 = {
        "note": 'note',
        "capture_type": 'capture_type',
        "amount": 'amount'
    }

    def __init__(self,
                 note=None,
                 capture_type=None,
                 amount=None):
        """Constructor for the CaptureSubscriptionRequest class"""

        # Initialize members of the class
        self.note = note 
        self.capture_type = capture_type 
        self.amount = 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
        note = dictionary.get("note") if dictionary.get("note") else None
        capture_type = dictionary.get("capture_type") if dictionary.get("capture_type") else None
        amount = Money.from_dictionary(dictionary.get('amount')) if dictionary.get('amount') else None
        # Return an object of this model
        return cls(note,
                   capture_type,
                   amount)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'note={self.note!r}, '
                f'capture_type={self.capture_type!r}, '
                f'amount={self.amount!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'note={self.note!s}, '
                f'capture_type={self.capture_type!s}, '
                f'amount={self.amount!s})')
