"""paypalserversdk.

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

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


class ParticipantMetadata(object):
    """Implementation of the 'Participant Metadata' model.

    Profile information of the sender or receiver.

    Attributes:
        ip_address (str): An Internet Protocol address (IP address). This address
            assigns a numerical label to each device that is connected to a computer
            network through the Internet Protocol. Supports IPv4 and IPv6 addresses.

    """

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

    _optionals = [
        "ip_address",
    ]

    def __init__(
        self,
        ip_address=APIHelper.SKIP):
        """Initialize a ParticipantMetadata instance."""
        # Initialize members of the class
        if ip_address is not APIHelper.SKIP:
            self.ip_address = ip_address

    @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
        ip_address =\
            dictionary.get("ip_address")\
            if dictionary.get("ip_address")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(ip_address)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"ip_address={_ip_address!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _ip_address=(
            self.ip_address
            if hasattr(self, "ip_address")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"ip_address={_ip_address!s}, "
            f")"
        )
