"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper


class SubscriptionPayerName(object):
    """Implementation of the 'Subscription Payer Name' model.

    The name of the party.

    Attributes:
        prefix (str): The prefix, or title, to the party's name.
        given_name (str): When the party is a person, the party's given, or first,
            name.
        surname (str): When the party is a person, the party's surname or family
            name. Also known as the last name. Required when the party is a person.
            Use also to store multiple surnames including the matronymic, or
            mother's, surname.
        middle_name (str): When the party is a person, the party's middle name. Use
            also to store multiple middle names including the patronymic, or
            father's, middle name.
        suffix (str): The suffix for the party's name.
        full_name (str): When the party is a person, the party's full name.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "prefix": "prefix",
        "given_name": "given_name",
        "surname": "surname",
        "middle_name": "middle_name",
        "suffix": "suffix",
        "full_name": "full_name",
    }

    _optionals = [
        "prefix",
        "given_name",
        "surname",
        "middle_name",
        "suffix",
        "full_name",
    ]

    def __init__(
        self,
        prefix=APIHelper.SKIP,
        given_name=APIHelper.SKIP,
        surname=APIHelper.SKIP,
        middle_name=APIHelper.SKIP,
        suffix=APIHelper.SKIP,
        full_name=APIHelper.SKIP):
        """Initialize a SubscriptionPayerName instance."""
        # Initialize members of the class
        if prefix is not APIHelper.SKIP:
            self.prefix = prefix
        if given_name is not APIHelper.SKIP:
            self.given_name = given_name
        if surname is not APIHelper.SKIP:
            self.surname = surname
        if middle_name is not APIHelper.SKIP:
            self.middle_name = middle_name
        if suffix is not APIHelper.SKIP:
            self.suffix = suffix
        if full_name is not APIHelper.SKIP:
            self.full_name = full_name

    @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
        prefix =\
            dictionary.get("prefix")\
            if dictionary.get("prefix")\
                else APIHelper.SKIP
        given_name =\
            dictionary.get("given_name")\
            if dictionary.get("given_name")\
                else APIHelper.SKIP
        surname =\
            dictionary.get("surname")\
            if dictionary.get("surname")\
                else APIHelper.SKIP
        middle_name =\
            dictionary.get("middle_name")\
            if dictionary.get("middle_name")\
                else APIHelper.SKIP
        suffix =\
            dictionary.get("suffix")\
            if dictionary.get("suffix")\
                else APIHelper.SKIP
        full_name =\
            dictionary.get("full_name")\
            if dictionary.get("full_name")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(prefix,
                   given_name,
                   surname,
                   middle_name,
                   suffix,
                   full_name)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _prefix=(
            self.prefix
            if hasattr(self, "prefix")
            else None
        )
        _given_name=(
            self.given_name
            if hasattr(self, "given_name")
            else None
        )
        _surname=(
            self.surname
            if hasattr(self, "surname")
            else None
        )
        _middle_name=(
            self.middle_name
            if hasattr(self, "middle_name")
            else None
        )
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _full_name=(
            self.full_name
            if hasattr(self, "full_name")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"prefix={_prefix!r}, "
            f"given_name={_given_name!r}, "
            f"surname={_surname!r}, "
            f"middle_name={_middle_name!r}, "
            f"suffix={_suffix!r}, "
            f"full_name={_full_name!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _prefix=(
            self.prefix
            if hasattr(self, "prefix")
            else None
        )
        _given_name=(
            self.given_name
            if hasattr(self, "given_name")
            else None
        )
        _surname=(
            self.surname
            if hasattr(self, "surname")
            else None
        )
        _middle_name=(
            self.middle_name
            if hasattr(self, "middle_name")
            else None
        )
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _full_name=(
            self.full_name
            if hasattr(self, "full_name")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"prefix={_prefix!s}, "
            f"given_name={_given_name!s}, "
            f"surname={_surname!s}, "
            f"middle_name={_middle_name!s}, "
            f"suffix={_suffix!s}, "
            f"full_name={_full_name!s}, "
            f")"
        )
