# -*- coding: utf-8 -*-

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper


class PayerName(object):

    """Implementation of the '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.
        alternate_full_name (str): DEPRECATED. The party's alternate name. Can
            be a business name, nickname, or any other name that cannot be
            split into first, last name. Required when the party is a business.
        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',
        "alternate_full_name": 'alternate_full_name',
        "full_name": 'full_name'
    }

    _optionals = [
        'prefix',
        'given_name',
        'surname',
        'middle_name',
        'suffix',
        'alternate_full_name',
        'full_name',
    ]

    def __init__(self,
                 prefix=APIHelper.SKIP,
                 given_name=APIHelper.SKIP,
                 surname=APIHelper.SKIP,
                 middle_name=APIHelper.SKIP,
                 suffix=APIHelper.SKIP,
                 alternate_full_name=APIHelper.SKIP,
                 full_name=APIHelper.SKIP):
        """Constructor for the PayerName class"""

        # 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 alternate_full_name is not APIHelper.SKIP:
            self.alternate_full_name = alternate_full_name 
        if full_name is not APIHelper.SKIP:
            self.full_name = full_name 

    @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
        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
        alternate_full_name = dictionary.get("alternate_full_name") if dictionary.get("alternate_full_name") 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,
                   alternate_full_name,
                   full_name)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'prefix={(self.prefix if hasattr(self, "prefix") else None)!r}, '
                f'given_name={(self.given_name if hasattr(self, "given_name") else None)!r}, '
                f'surname={(self.surname if hasattr(self, "surname") else None)!r}, '
                f'middle_name={(self.middle_name if hasattr(self, "middle_name") else None)!r}, '
                f'suffix={(self.suffix if hasattr(self, "suffix") else None)!r}, '
                f'alternate_full_name={(self.alternate_full_name if hasattr(self, "alternate_full_name") else None)!r}, '
                f'full_name={(self.full_name if hasattr(self, "full_name") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'prefix={(self.prefix if hasattr(self, "prefix") else None)!s}, '
                f'given_name={(self.given_name if hasattr(self, "given_name") else None)!s}, '
                f'surname={(self.surname if hasattr(self, "surname") else None)!s}, '
                f'middle_name={(self.middle_name if hasattr(self, "middle_name") else None)!s}, '
                f'suffix={(self.suffix if hasattr(self, "suffix") else None)!s}, '
                f'alternate_full_name={(self.alternate_full_name if hasattr(self, "alternate_full_name") else None)!s}, '
                f'full_name={(self.full_name if hasattr(self, "full_name") else None)!s})')
