# coding: utf-8

"""
    Habitat repository and authorization API

    Habitat API  # noqa: E501

    OpenAPI spec version: V1.1.1
    Contact: zives@seas.upenn.edu
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six

from pennprov.models.attribute import Attribute  # noqa: F401,E501
from pennprov.models.qualified_name import QualifiedName  # noqa: F401,E501


class RelationModel(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'attributes': 'list[Attribute]',
        'type': 'str',
        'subject_id': 'QualifiedName',
        'object_id': 'QualifiedName',
        'secondary_object_id': 'QualifiedName',
        'relation_id': 'QualifiedName',
        'time': 'datetime',
        'generation_id': 'QualifiedName',
        'usage_id': 'QualifiedName'
    }

    attribute_map = {
        'attributes': 'attributes',
        'type': 'type',
        'subject_id': 'subjectId',
        'object_id': 'objectId',
        'secondary_object_id': 'secondaryObjectId',
        'relation_id': 'relationId',
        'time': 'time',
        'generation_id': 'generationId',
        'usage_id': 'usageId'
    }

    def __init__(self, attributes=None, type=None, subject_id=None, object_id=None, secondary_object_id=None, relation_id=None, time=None, generation_id=None, usage_id=None):  # noqa: E501
        """RelationModel - a model defined in Swagger"""  # noqa: E501

        self._attributes = None
        self._type = None
        self._subject_id = None
        self._object_id = None
        self._secondary_object_id = None
        self._relation_id = None
        self._time = None
        self._generation_id = None
        self._usage_id = None
        self.discriminator = None

        if attributes is not None:
            self.attributes = attributes
        self.type = type
        self.subject_id = subject_id
        self.object_id = object_id
        if secondary_object_id is not None:
            self.secondary_object_id = secondary_object_id
        if relation_id is not None:
            self.relation_id = relation_id
        if time is not None:
            self.time = time
        if generation_id is not None:
            self.generation_id = generation_id
        if usage_id is not None:
            self.usage_id = usage_id

    @property
    def attributes(self):
        """Gets the attributes of this RelationModel.  # noqa: E501

        It is an error to include attributes in a MEMEBERSHIP, ALTERNATE, or SPECIALIZATION relation  # noqa: E501

        :return: The attributes of this RelationModel.  # noqa: E501
        :rtype: list[Attribute]
        """
        return self._attributes

    @attributes.setter
    def attributes(self, attributes):
        """Sets the attributes of this RelationModel.

        It is an error to include attributes in a MEMEBERSHIP, ALTERNATE, or SPECIALIZATION relation  # noqa: E501

        :param attributes: The attributes of this RelationModel.  # noqa: E501
        :type: list[Attribute]
        """

        self._attributes = attributes

    @property
    def type(self):
        """Gets the type of this RelationModel.  # noqa: E501


        :return: The type of this RelationModel.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this RelationModel.


        :param type: The type of this RelationModel.  # noqa: E501
        :type: str
        """
        if type is None:
            raise ValueError("Invalid value for `type`, must not be `None`")  # noqa: E501
        allowed_values = ["GENERATION", "USAGE", "COMMUNICATION", "START", "END", "INVALIDATION", "DERIVATION", "ATTRIBUTION", "ASSOCIATION", "DELEGATION", "INFLUENCE", "SPECIALIZATION", "ALTERNATE", "ANNOTATED", "MEMBERSHIP"]  # noqa: E501
        if type not in allowed_values:
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}"  # noqa: E501
                .format(type, allowed_values)
            )

        self._type = type

    @property
    def subject_id(self):
        """Gets the subject_id of this RelationModel.  # noqa: E501


        :return: The subject_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._subject_id

    @subject_id.setter
    def subject_id(self, subject_id):
        """Sets the subject_id of this RelationModel.


        :param subject_id: The subject_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """
        if subject_id is None:
            raise ValueError("Invalid value for `subject_id`, must not be `None`")  # noqa: E501

        self._subject_id = subject_id

    @property
    def object_id(self):
        """Gets the object_id of this RelationModel.  # noqa: E501


        :return: The object_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._object_id

    @object_id.setter
    def object_id(self, object_id):
        """Sets the object_id of this RelationModel.


        :param object_id: The object_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """
        if object_id is None:
            raise ValueError("Invalid value for `object_id`, must not be `None`")  # noqa: E501

        self._object_id = object_id

    @property
    def secondary_object_id(self):
        """Gets the secondary_object_id of this RelationModel.  # noqa: E501

        It is an error to include a secondary object in a relation other than ASSOCIATION, DERIVATION, START, END, or DELEGATION  # noqa: E501

        :return: The secondary_object_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._secondary_object_id

    @secondary_object_id.setter
    def secondary_object_id(self, secondary_object_id):
        """Sets the secondary_object_id of this RelationModel.

        It is an error to include a secondary object in a relation other than ASSOCIATION, DERIVATION, START, END, or DELEGATION  # noqa: E501

        :param secondary_object_id: The secondary_object_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """

        self._secondary_object_id = secondary_object_id

    @property
    def relation_id(self):
        """Gets the relation_id of this RelationModel.  # noqa: E501

        It is an error to include attributes in a MEMEBERSHIP, ALTERNATE, or SPECIALIZATION relation  # noqa: E501

        :return: The relation_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._relation_id

    @relation_id.setter
    def relation_id(self, relation_id):
        """Sets the relation_id of this RelationModel.

        It is an error to include attributes in a MEMEBERSHIP, ALTERNATE, or SPECIALIZATION relation  # noqa: E501

        :param relation_id: The relation_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """

        self._relation_id = relation_id

    @property
    def time(self):
        """Gets the time of this RelationModel.  # noqa: E501

        It is an error to include time in a relation other than GENERATION, USAGE, START, END, or INVALIDATION  # noqa: E501

        :return: The time of this RelationModel.  # noqa: E501
        :rtype: datetime
        """
        return self._time

    @time.setter
    def time(self, time):
        """Sets the time of this RelationModel.

        It is an error to include time in a relation other than GENERATION, USAGE, START, END, or INVALIDATION  # noqa: E501

        :param time: The time of this RelationModel.  # noqa: E501
        :type: datetime
        """

        self._time = time

    @property
    def generation_id(self):
        """Gets the generation_id of this RelationModel.  # noqa: E501

        It is an error to include a generation id in a relation other than DERIVATION  # noqa: E501

        :return: The generation_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._generation_id

    @generation_id.setter
    def generation_id(self, generation_id):
        """Sets the generation_id of this RelationModel.

        It is an error to include a generation id in a relation other than DERIVATION  # noqa: E501

        :param generation_id: The generation_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """

        self._generation_id = generation_id

    @property
    def usage_id(self):
        """Gets the usage_id of this RelationModel.  # noqa: E501

        It is an error to include a usage id in a relation other than DERIVATION  # noqa: E501

        :return: The usage_id of this RelationModel.  # noqa: E501
        :rtype: QualifiedName
        """
        return self._usage_id

    @usage_id.setter
    def usage_id(self, usage_id):
        """Sets the usage_id of this RelationModel.

        It is an error to include a usage id in a relation other than DERIVATION  # noqa: E501

        :param usage_id: The usage_id of this RelationModel.  # noqa: E501
        :type: QualifiedName
        """

        self._usage_id = usage_id

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value
        if issubclass(RelationModel, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, RelationModel):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other
