"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.customer_information import (
    CustomerInformation,
)
from paypalserversdk.models.link_description import (
    LinkDescription,
)


class VenmoVaultResponse(object):
    """Implementation of the 'Venmo Vault Response' model.

    The details about a saved venmo payment source.

    Attributes:
        id (str): The PayPal-generated ID for the saved payment source.
        status (VenmoVaultResponseStatus): The vault status.
        links (List[LinkDescription]): An array of request-related HATEOAS links.
        customer (CustomerInformation): This object represents a merchant’s customer,
            allowing them to store contact details, and track all payments associated
            with the same customer.

    """

    # 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):
        """Initialize a VenmoVaultResponse instance."""
        # 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):
        """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
        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 =\
            CustomerInformation.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)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"status={_status!r}, "
            f"links={_links!r}, "
            f"customer={_customer!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"status={_status!s}, "
            f"links={_links!s}, "
            f"customer={_customer!s}, "
            f")"
        )
