# coding: utf-8

"""
    Tator REST API

    Interface to the Tator backend.  # noqa: E501

    The version of the OpenAPI document: v1
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from ..configuration import Configuration


class AutocompleteService(object):
    """
    """

    """
    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 = {
        'match_any': 'bool',
        'min_level': 'int',
        'mode': 'str',
        'service_url': 'str',
        'use_common': 'bool'
    }

    attribute_map = {
        'match_any': 'match_any',
        'min_level': 'minLevel',
        'mode': 'mode',
        'service_url': 'serviceUrl',
        'use_common': 'useCommon'
    }

    def __init__(self, match_any=False, min_level=None, mode='tator', service_url=None, use_common=None, local_vars_configuration=None):  # noqa: E501
        """AutocompleteService - a model defined in OpenAPI"""
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._match_any = None
        self._min_level = None
        self._mode = None
        self._service_url = None
        self._use_common = None
        self.discriminator = None

        if match_any is not None:
            self.match_any = match_any
        if min_level is not None:
            self.min_level = min_level
        if mode is not None:
            self.mode = mode
        if service_url is not None:
            self.service_url = service_url
        if use_common is not None:
            self.use_common = use_common

    @property
    def match_any(self):
        """
        If true, autocomplete will find leaves with any part of name matching the query. Otherwise only leaf names that start with the query are returned.

        :return: The match_any of this AutocompleteService. 
        :rtype: bool
        """
        return self._match_any

    @match_any.setter
    def match_any(self, match_any):
        """
        If true, autocomplete will find leaves with any part of name matching the query. Otherwise only leaf names that start with the query are returned.

        :param match_any: The match_any of this AutocompleteService.
        :type: bool
        """

        self._match_any = match_any

    @property
    def min_level(self):
        """
        If using WoRMS, set this to the minimum returnable taxonomic levelSee https://www.marinespecies.org/rest/AphiaTaxonRanksByID/-1?AphiaID=2 for the levels, Note: 220 is species

        :return: The min_level of this AutocompleteService. 
        :rtype: int
        """
        return self._min_level

    @min_level.setter
    def min_level(self, min_level):
        """
        If using WoRMS, set this to the minimum returnable taxonomic levelSee https://www.marinespecies.org/rest/AphiaTaxonRanksByID/-1?AphiaID=2 for the levels, Note: 220 is species

        :param min_level: The min_level of this AutocompleteService.
        :type: int
        """

        self._min_level = min_level

    @property
    def mode(self):
        """
        Change flavor of autocomplete to use built-in WoRMs support. For information on WoRMs see https://www.marinespecies.org/rest/

        :return: The mode of this AutocompleteService. 
        :rtype: str
        """
        return self._mode

    @mode.setter
    def mode(self, mode):
        """
        Change flavor of autocomplete to use built-in WoRMs support. For information on WoRMs see https://www.marinespecies.org/rest/

        :param mode: The mode of this AutocompleteService.
        :type: str
        """
        allowed_values = ["tator", "worms"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and mode not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `mode` ({0}), must be one of {1}"  # noqa: E501
                .format(mode, allowed_values)
            )

        self._mode = mode

    @property
    def service_url(self):
        """
        URL of the autocomplete service.

        :return: The service_url of this AutocompleteService. 
        :rtype: str
        """
        return self._service_url

    @service_url.setter
    def service_url(self, service_url):
        """
        URL of the autocomplete service.

        :param service_url: The service_url of this AutocompleteService.
        :type: str
        """

        self._service_url = service_url

    @property
    def use_common(self):
        """
        If using WoRMS, if set to true, use common names (vernacular in their API)

        :return: The use_common of this AutocompleteService. 
        :rtype: bool
        """
        return self._use_common

    @use_common.setter
    def use_common(self, use_common):
        """
        If using WoRMS, if set to true, use common names (vernacular in their API)

        :param use_common: The use_common of this AutocompleteService.
        :type: bool
        """

        self._use_common = use_common

    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, AutocompleteService):
            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, AutocompleteService):
            return True

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