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

"""
paypalserversdk

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


class CallbackConfiguration(object):

    """Implementation of the 'Callback Configuration' model.

    CallBack Configuration that the merchant can provide to PayPal/Venmo.

    Attributes:
        callback_events (List[CallbackEvents]): An array of callback events
            merchant can subscribe to for the corresponding callback url.
        callback_url (str): Merchant provided CallBack url.PayPal/Venmo will
            use this url to call the merchant back when the events occur
            .PayPal/Venmo expects a secured url usually in the https
            format.merchant can append the cart id or other params part of the
            url as query or path params.

    """

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

    def __init__(self,
                 callback_events=None,
                 callback_url=None):
        """Constructor for the CallbackConfiguration class"""

        # Initialize members of the class
        self.callback_events = callback_events 
        self.callback_url = callback_url 

    @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
        callback_events = dictionary.get("callback_events") if dictionary.get("callback_events") else None
        callback_url = dictionary.get("callback_url") if dictionary.get("callback_url") else None
        # Return an object of this model
        return cls(callback_events,
                   callback_url)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'callback_events={self.callback_events!r}, '
                f'callback_url={self.callback_url!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'callback_events={self.callback_events!s}, '
                f'callback_url={self.callback_url!s})')
