"""mindbodypublicapi.

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

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


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

    Jim is a RelationshipName1 of John. John is a RelationshipName2 of Jim.

    Attributes:
        id (int): The ID of the relationship.
        relationship_name_1 (str): The name of the first relationship.
        relationship_name_2 (str): The name of the second relationship.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "relationship_name_1": "RelationshipName1",
        "relationship_name_2": "RelationshipName2",
    }

    _optionals = [
        "id",
        "relationship_name_1",
        "relationship_name_2",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        relationship_name_1=APIHelper.SKIP,
        relationship_name_2=APIHelper.SKIP):
        """Initialize a Relationship instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if relationship_name_1 is not APIHelper.SKIP:
            self.relationship_name_1 = relationship_name_1
        if relationship_name_2 is not APIHelper.SKIP:
            self.relationship_name_2 = relationship_name_2

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

        # Return an object of this model
        return cls(id,
                   relationship_name_1,
                   relationship_name_2)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _relationship_name_1=(
            self.relationship_name_1
            if hasattr(self, "relationship_name_1")
            else None
        )
        _relationship_name_2=(
            self.relationship_name_2
            if hasattr(self, "relationship_name_2")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"relationship_name_1={_relationship_name_1!r}, "
            f"relationship_name_2={_relationship_name_2!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _relationship_name_1=(
            self.relationship_name_1
            if hasattr(self, "relationship_name_1")
            else None
        )
        _relationship_name_2=(
            self.relationship_name_2
            if hasattr(self, "relationship_name_2")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"relationship_name_1={_relationship_name_1!s}, "
            f"relationship_name_2={_relationship_name_2!s}, "
            f")"
        )
