# -*- 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.link_description import LinkDescription
from paypalserversdk.models.pay_pal_wallet_customer import PayPalWalletCustomer


class PayPalWalletVaultResponse(object):

    """Implementation of the 'PayPal Wallet Vault Response' model.

    The details about a saved PayPal Wallet payment source.

    Attributes:
        id (str): The PayPal-generated ID for the saved payment source.
        status (PayPalWalletVaultStatus): The vault status.
        links (List[LinkDescription]): An array of request-related HATEOAS
            links.
        customer (PayPalWalletCustomer): The details about a customer in
            PayPal's system of record.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "status": 'status',
        "links": 'links',
        "customer": 'customer'
    }

    _optionals = [
        'id',
        'status',
        'links',
        'customer',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 status=APIHelper.SKIP,
                 links=APIHelper.SKIP,
                 customer=APIHelper.SKIP):
        """Constructor for the PayPalWalletVaultResponse class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if status is not APIHelper.SKIP:
            self.status = status 
        if links is not APIHelper.SKIP:
            self.links = links 
        if customer is not APIHelper.SKIP:
            self.customer = customer 

    @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 dictionary is None:
            return None

        # Extract variables from the dictionary
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        status = dictionary.get("status") if dictionary.get("status") else APIHelper.SKIP
        links = None
        if dictionary.get('links') is not None:
            links = [LinkDescription.from_dictionary(x) for x in dictionary.get('links')]
        else:
            links = APIHelper.SKIP
        customer = PayPalWalletCustomer.from_dictionary(dictionary.get('customer')) if 'customer' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   status,
                   links,
                   customer)
