"""cellpointapi.

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

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


class PersonName(object):
    """Implementation of the 'PersonName' model.

    Name of an individual person.
    The given name (or acquired name in some cultures) can precede a family name (as
    in some European cultures),
    or it can come after the family name (as in some East Asian cultures), or be used
    without a family name.

    Attributes:
        given_name (str): Name bestowed upon an individual to differentiate them from
            other members of a group that share a family name.  In the U.S., the
            first name of a Person.
        family_name (str): Name bestowed upon an individual to denote membership in a
            group or family.  In the U.S., the last name of a Person.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "given_name": "givenName",
        "family_name": "familyName",
    }

    def __init__(
        self,
        given_name=None,
        family_name=None,
        additional_properties=None):
        """Initialize a PersonName instance."""
        # Initialize members of the class
        self.given_name = given_name
        self.family_name = family_name

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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
        given_name =\
            dictionary.get("givenName")\
            if dictionary.get("givenName")\
                else None
        family_name =\
            dictionary.get("familyName")\
            if dictionary.get("familyName")\
                else None

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(given_name,
                   family_name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _given_name=self.given_name
        _family_name=self.family_name
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"given_name={_given_name!r}, "
            f"family_name={_family_name!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _given_name=self.given_name
        _family_name=self.family_name
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"given_name={_given_name!s}, "
            f"family_name={_family_name!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
