# -*- 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.payer_name import PayerName
from paypalserversdk.models.phone import Phone
from paypalserversdk.models.simple_postal_address_coarse_grained import SimplePostalAddressCoarseGrained


class PayerInformation(object):

    """Implementation of the 'Payer Information' model.

    The payer information.

    Attributes:
        account_id (str): The PayPal` customer account ID.
        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_number (Phone): The phone number, in its canonical international
            [E.164 numbering plan
            format](https://www.itu.int/rec/T-REC-E.164/en).
        address_status (str): The address status of the payer. Value is
            either: Y. Verified. N. Not verified.
        payer_status (str): The status of the payer. Value is `Y` or `N`.
        payer_name (PayerName): The name of the party.
        country_code (str): The [two-character ISO 3166-1
            code](/docs/integration/direct/rest/country-codes/) that
            identifies the country or region. Note: The country code for Great
            Britain is GB and not UK as used in the top-level domain names for
            that country. Use the `C2` country code for China worldwide for
            comparable uncontrolled price (CUP) method, bank card, and
            cross-border transactions.
        address (SimplePostalAddressCoarseGrained): A simple postal address
            with coarse-grained fields. Do not use for an international
            address. Use for backward compatibility only. Does not contain
            phone.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "account_id": 'account_id',
        "email_address": 'email_address',
        "phone_number": 'phone_number',
        "address_status": 'address_status',
        "payer_status": 'payer_status',
        "payer_name": 'payer_name',
        "country_code": 'country_code',
        "address": 'address'
    }

    _optionals = [
        'account_id',
        'email_address',
        'phone_number',
        'address_status',
        'payer_status',
        'payer_name',
        'country_code',
        'address',
    ]

    def __init__(self,
                 account_id=APIHelper.SKIP,
                 email_address=APIHelper.SKIP,
                 phone_number=APIHelper.SKIP,
                 address_status=APIHelper.SKIP,
                 payer_status=APIHelper.SKIP,
                 payer_name=APIHelper.SKIP,
                 country_code=APIHelper.SKIP,
                 address=APIHelper.SKIP):
        """Constructor for the PayerInformation class"""

        # Initialize members of the class
        if account_id is not APIHelper.SKIP:
            self.account_id = account_id 
        if email_address is not APIHelper.SKIP:
            self.email_address = email_address 
        if phone_number is not APIHelper.SKIP:
            self.phone_number = phone_number 
        if address_status is not APIHelper.SKIP:
            self.address_status = address_status 
        if payer_status is not APIHelper.SKIP:
            self.payer_status = payer_status 
        if payer_name is not APIHelper.SKIP:
            self.payer_name = payer_name 
        if country_code is not APIHelper.SKIP:
            self.country_code = country_code 
        if address is not APIHelper.SKIP:
            self.address = address 

    @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
        account_id = dictionary.get("account_id") if dictionary.get("account_id") else APIHelper.SKIP
        email_address = dictionary.get("email_address") if dictionary.get("email_address") else APIHelper.SKIP
        phone_number = Phone.from_dictionary(dictionary.get('phone_number')) if 'phone_number' in dictionary.keys() else APIHelper.SKIP
        address_status = dictionary.get("address_status") if dictionary.get("address_status") else APIHelper.SKIP
        payer_status = dictionary.get("payer_status") if dictionary.get("payer_status") else APIHelper.SKIP
        payer_name = PayerName.from_dictionary(dictionary.get('payer_name')) if 'payer_name' in dictionary.keys() else APIHelper.SKIP
        country_code = dictionary.get("country_code") if dictionary.get("country_code") else APIHelper.SKIP
        address = SimplePostalAddressCoarseGrained.from_dictionary(dictionary.get('address')) if 'address' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(account_id,
                   email_address,
                   phone_number,
                   address_status,
                   payer_status,
                   payer_name,
                   country_code,
                   address)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'account_id={(self.account_id if hasattr(self, "account_id") else None)!r}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!r}, '
                f'phone_number={(self.phone_number if hasattr(self, "phone_number") else None)!r}, '
                f'address_status={(self.address_status if hasattr(self, "address_status") else None)!r}, '
                f'payer_status={(self.payer_status if hasattr(self, "payer_status") else None)!r}, '
                f'payer_name={(self.payer_name if hasattr(self, "payer_name") else None)!r}, '
                f'country_code={(self.country_code if hasattr(self, "country_code") else None)!r}, '
                f'address={(self.address if hasattr(self, "address") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'account_id={(self.account_id if hasattr(self, "account_id") else None)!s}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!s}, '
                f'phone_number={(self.phone_number if hasattr(self, "phone_number") else None)!s}, '
                f'address_status={(self.address_status if hasattr(self, "address_status") else None)!s}, '
                f'payer_status={(self.payer_status if hasattr(self, "payer_status") else None)!s}, '
                f'payer_name={(self.payer_name if hasattr(self, "payer_name") else None)!s}, '
                f'country_code={(self.country_code if hasattr(self, "country_code") else None)!s}, '
                f'address={(self.address if hasattr(self, "address") else None)!s})')
