"""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.phone_with_type import (
    PhoneWithType,
)


class SubscriptionCustomerInformation(object):
    """Implementation of the 'Subscription Customer Information' model.

    The details about a customer in PayPal's system of record.

    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.

    """

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

    _optionals = [
        "id",
        "email_address",
        "phone",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        email_address=APIHelper.SKIP,
        phone=APIHelper.SKIP):
        """Initialize a SubscriptionCustomerInformation instance."""
        # 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

    @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
        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

        # Return an object of this model
        return cls(id,
                   email_address,
                   phone)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _email_address=(
            self.email_address
            if hasattr(self, "email_address")
            else None
        )
        _phone=(
            self.phone
            if hasattr(self, "phone")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"email_address={_email_address!r}, "
            f"phone={_phone!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _email_address=(
            self.email_address
            if hasattr(self, "email_address")
            else None
        )
        _phone=(
            self.phone
            if hasattr(self, "phone")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"email_address={_email_address!s}, "
            f"phone={_phone!s}, "
            f")"
        )
