"""paypalserversdk.

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

# ruff: noqa: E501
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):
        """Initialize a CaptureSubscriptionRequest instance."""
        # Initialize members of the class
        self.note = note
        self.capture_type = capture_type
        self.amount = amount

    @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
        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 a unambiguous string representation."""
        _note=self.note
        _capture_type=self.capture_type
        _amount=self.amount
        return (
            f"{self.__class__.__name__}("
            f"note={_note!r}, "
            f"capture_type={_capture_type!r}, "
            f"amount={_amount!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _note=self.note
        _capture_type=self.capture_type
        _amount=self.amount
        return (
            f"{self.__class__.__name__}("
            f"note={_note!s}, "
            f"capture_type={_capture_type!s}, "
            f"amount={_amount!s}, "
            f")"
        )
