# coding: utf-8

"""
    Tool Registry API

    The OpenAPI specification implemented by the Tool Registry. # Overview TBA   # noqa: E501

    The version of the OpenAPI document: 0.1.0
    Contact: thomas.schaffter@sagebionetworks.org
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from toolregistryclient.configuration import Configuration


class Tool(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'id': 'str',
        'name': 'str',
        'version': 'str',
        'license': 'str',
        'repository': 'str',
        'description': 'str',
        'author': 'str',
        'author_email': 'str',
        'url': 'str'
    }

    attribute_map = {
        'id': 'id',
        'name': 'name',
        'version': 'version',
        'license': 'license',
        'repository': 'repository',
        'description': 'description',
        'author': 'author',
        'author_email': 'authorEmail',
        'url': 'url'
    }

    def __init__(self, id=None, name=None, version=None, license=None, repository=None, description=None, author=None, author_email=None, url=None, local_vars_configuration=None):  # noqa: E501
        """Tool - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._id = None
        self._name = None
        self._version = None
        self._license = None
        self._repository = None
        self._description = None
        self._author = None
        self._author_email = None
        self._url = None
        self.discriminator = None

        if id is not None:
            self.id = id
        if name is not None:
            self.name = name
        if version is not None:
            self.version = version
        if license is not None:
            self.license = license
        if repository is not None:
            self.repository = repository
        if description is not None:
            self.description = description
        if author is not None:
            self.author = author
        if author_email is not None:
            self.author_email = author_email
        if url is not None:
            self.url = url

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

        The ID of the tool  # noqa: E501

        :return: The id of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this Tool.

        The ID of the tool  # noqa: E501

        :param id: The id of this Tool.  # noqa: E501
        :type id: str
        """

        self._id = id

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

        The tool name  # noqa: E501

        :return: The name of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this Tool.

        The tool name  # noqa: E501

        :param name: The name of this Tool.  # noqa: E501
        :type name: str
        """
        if (self.local_vars_configuration.client_side_validation and
                name is not None and len(name) > 60):
            raise ValueError("Invalid value for `name`, length must be less than or equal to `60`")  # noqa: E501
        if (self.local_vars_configuration.client_side_validation and
                name is not None and len(name) < 3):
            raise ValueError("Invalid value for `name`, length must be greater than or equal to `3`")  # noqa: E501
        if (self.local_vars_configuration.client_side_validation and
                name is not None and not re.search(r'^[a-z0-9]+(?:-[a-z0-9]+)*$', name)):  # noqa: E501
            raise ValueError(r"Invalid value for `name`, must be a follow pattern or equal to `/^[a-z0-9]+(?:-[a-z0-9]+)*$/`")  # noqa: E501

        self._name = name

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

        The version of the tool (SemVer string)  # noqa: E501

        :return: The version of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._version

    @version.setter
    def version(self, version):
        """Sets the version of this Tool.

        The version of the tool (SemVer string)  # noqa: E501

        :param version: The version of this Tool.  # noqa: E501
        :type version: str
        """
        if (self.local_vars_configuration.client_side_validation and
                version is not None and len(version) < 1):
            raise ValueError("Invalid value for `version`, length must be greater than or equal to `1`")  # noqa: E501
        if (self.local_vars_configuration.client_side_validation and
                version is not None and not re.search(r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', version)):  # noqa: E501
            raise ValueError(r"Invalid value for `version`, must be a follow pattern or equal to `/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/`")  # noqa: E501

        self._version = version

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

        The license of this service (spdx.org/licenses Identifier)  # noqa: E501

        :return: The license of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._license

    @license.setter
    def license(self, license):
        """Sets the license of this Tool.

        The license of this service (spdx.org/licenses Identifier)  # noqa: E501

        :param license: The license of this Tool.  # noqa: E501
        :type license: str
        """
        allowed_values = ["afl-3.0", "apache-2.0", "artistic-2.0", "bsl-1.0", "bsd-2-clause", "bsd-3-clause", "bsd-3-clause-clear", "cc", "cc0-1.0", "cc-by-4.0", "cc-by-sa-4.0", "wtfpl", "ecl-2.0", "epl-1.0", "epl-2.0", "eupl-1.1", "agpl-3.0", "gpl", "gpl-2.0", "gpl-3.0", "lgpl", "lgpl-2.1", "lgpl-3.0", "isc", "lppl-1.3c", "ms-pl", "mit", "mpl-2.0", "osl-3.0", "postgresql", "ofl-1.1", "ncsa", "unlicense", "zlib"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and license not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `license` ({0}), must be one of {1}"  # noqa: E501
                .format(license, allowed_values)
            )

        self._license = license

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

        The place where the code lives  # noqa: E501

        :return: The repository of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._repository

    @repository.setter
    def repository(self, repository):
        """Sets the repository of this Tool.

        The place where the code lives  # noqa: E501

        :param repository: The repository of this Tool.  # noqa: E501
        :type repository: str
        """

        self._repository = repository

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

        A short, one-sentence summary of the service  # noqa: E501

        :return: The description of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this Tool.

        A short, one-sentence summary of the service  # noqa: E501

        :param description: The description of this Tool.  # noqa: E501
        :type description: str
        """
        if (self.local_vars_configuration.client_side_validation and
                description is not None and len(description) > 100):
            raise ValueError("Invalid value for `description`, length must be less than or equal to `100`")  # noqa: E501

        self._description = description

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

        The author of the tool  # noqa: E501

        :return: The author of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._author

    @author.setter
    def author(self, author):
        """Sets the author of this Tool.

        The author of the tool  # noqa: E501

        :param author: The author of this Tool.  # noqa: E501
        :type author: str
        """

        self._author = author

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

        The email address of the author  # noqa: E501

        :return: The author_email of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._author_email

    @author_email.setter
    def author_email(self, author_email):
        """Sets the author_email of this Tool.

        The email address of the author  # noqa: E501

        :param author_email: The author_email of this Tool.  # noqa: E501
        :type author_email: str
        """

        self._author_email = author_email

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

        The URL to the homepage of the tool  # noqa: E501

        :return: The url of this Tool.  # noqa: E501
        :rtype: str
        """
        return self._url

    @url.setter
    def url(self, url):
        """Sets the url of this Tool.

        The URL to the homepage of the tool  # noqa: E501

        :param url: The url of this Tool.  # noqa: E501
        :type url: str
        """

        self._url = url

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

        for attr, _ in six.iteritems(self.openapi_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

        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, Tool):
            return False

        return self.to_dict() == other.to_dict()

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

        return self.to_dict() != other.to_dict()
