"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.relationship import (
    Relationship,
)


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

    A relation between two clients.

    Attributes:
        related_client_id (str): The RSSID of the related client.
        related_unique_id (int): The UniqueId of the related client.
        relationship (Relationship): Jim is a RelationshipName1 of John. John is a
            RelationshipName2 of Jim.
        relationship_name (str): The name of the relationship of the related client.
        delete (bool): When true, the associated relationship is removed from the
            client’s list of relationships.  This property is ignored in all other
            use cases.  Default: *false*

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "related_client_id": "RelatedClientId",
        "related_unique_id": "RelatedUniqueId",
        "relationship": "Relationship",
        "relationship_name": "RelationshipName",
        "delete": "Delete",
    }

    _optionals = [
        "related_client_id",
        "related_unique_id",
        "relationship",
        "relationship_name",
        "delete",
    ]

    def __init__(
        self,
        related_client_id=APIHelper.SKIP,
        related_unique_id=APIHelper.SKIP,
        relationship=APIHelper.SKIP,
        relationship_name=APIHelper.SKIP,
        delete=APIHelper.SKIP):
        """Initialize a ClientRelationship instance."""
        # Initialize members of the class
        if related_client_id is not APIHelper.SKIP:
            self.related_client_id = related_client_id
        if related_unique_id is not APIHelper.SKIP:
            self.related_unique_id = related_unique_id
        if relationship is not APIHelper.SKIP:
            self.relationship = relationship
        if relationship_name is not APIHelper.SKIP:
            self.relationship_name = relationship_name
        if delete is not APIHelper.SKIP:
            self.delete = delete

    @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
        related_client_id =\
            dictionary.get("RelatedClientId")\
            if dictionary.get("RelatedClientId")\
                else APIHelper.SKIP
        related_unique_id =\
            dictionary.get("RelatedUniqueId")\
            if dictionary.get("RelatedUniqueId")\
                else APIHelper.SKIP
        relationship =\
            Relationship.from_dictionary(
                dictionary.get("Relationship"))\
                if "Relationship" in dictionary.keys()\
                else APIHelper.SKIP
        relationship_name =\
            dictionary.get("RelationshipName")\
            if dictionary.get("RelationshipName")\
                else APIHelper.SKIP
        delete =\
            dictionary.get("Delete")\
            if "Delete" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(related_client_id,
                   related_unique_id,
                   relationship,
                   relationship_name,
                   delete)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _related_client_id=(
            self.related_client_id
            if hasattr(self, "related_client_id")
            else None
        )
        _related_unique_id=(
            self.related_unique_id
            if hasattr(self, "related_unique_id")
            else None
        )
        _relationship=(
            self.relationship
            if hasattr(self, "relationship")
            else None
        )
        _relationship_name=(
            self.relationship_name
            if hasattr(self, "relationship_name")
            else None
        )
        _delete=(
            self.delete
            if hasattr(self, "delete")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"related_client_id={_related_client_id!r}, "
            f"related_unique_id={_related_unique_id!r}, "
            f"relationship={_relationship!r}, "
            f"relationship_name={_relationship_name!r}, "
            f"delete={_delete!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _related_client_id=(
            self.related_client_id
            if hasattr(self, "related_client_id")
            else None
        )
        _related_unique_id=(
            self.related_unique_id
            if hasattr(self, "related_unique_id")
            else None
        )
        _relationship=(
            self.relationship
            if hasattr(self, "relationship")
            else None
        )
        _relationship_name=(
            self.relationship_name
            if hasattr(self, "relationship_name")
            else None
        )
        _delete=(
            self.delete
            if hasattr(self, "delete")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"related_client_id={_related_client_id!s}, "
            f"related_unique_id={_related_unique_id!s}, "
            f"relationship={_relationship!s}, "
            f"relationship_name={_relationship_name!s}, "
            f"delete={_delete!s}, "
            f")"
        )
