# -*- 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.name import Name
from paypalserversdk.models.phone_with_type import PhoneWithType


class PaypalWalletCustomerRequest(object):

    """Implementation of the 'PayPal Wallet Customer Request' model.

    Attributes:
        id (str): The unique ID for a customer generated by PayPal.
        email_address (str): The internationalized email address. Note: Up to
            64 characters are allowed before and 255 characters are allowed
            after the @ sign. However, the generally accepted maximum length
            for an email address is 254 characters. The pattern verifies that
            an unquoted @ sign exists.
        phone (PhoneWithType): The phone information.
        name (Name): The name of the party.
        merchant_customer_id (str): Merchants and partners may already have a
            data-store where their customer information is persisted. Use
            merchant_customer_id to associate the PayPal-generated customer.id
            to your representation of a customer.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "email_address": 'email_address',
        "phone": 'phone',
        "name": 'name',
        "merchant_customer_id": 'merchant_customer_id'
    }

    _optionals = [
        'id',
        'email_address',
        'phone',
        'name',
        'merchant_customer_id',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 email_address=APIHelper.SKIP,
                 phone=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 merchant_customer_id=APIHelper.SKIP):
        """Constructor for the PaypalWalletCustomerRequest class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if email_address is not APIHelper.SKIP:
            self.email_address = email_address 
        if phone is not APIHelper.SKIP:
            self.phone = phone 
        if name is not APIHelper.SKIP:
            self.name = name 
        if merchant_customer_id is not APIHelper.SKIP:
            self.merchant_customer_id = merchant_customer_id 

    @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
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        email_address = dictionary.get("email_address") if dictionary.get("email_address") else APIHelper.SKIP
        phone = PhoneWithType.from_dictionary(dictionary.get('phone')) if 'phone' in dictionary.keys() else APIHelper.SKIP
        name = Name.from_dictionary(dictionary.get('name')) if 'name' in dictionary.keys() else APIHelper.SKIP
        merchant_customer_id = dictionary.get("merchant_customer_id") if dictionary.get("merchant_customer_id") else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   email_address,
                   phone,
                   name,
                   merchant_customer_id)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!r}, '
                f'phone={(self.phone if hasattr(self, "phone") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'merchant_customer_id={(self.merchant_customer_id if hasattr(self, "merchant_customer_id") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!s}, '
                f'phone={(self.phone if hasattr(self, "phone") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'merchant_customer_id={(self.merchant_customer_id if hasattr(self, "merchant_customer_id") else None)!s})')
