# coding: utf-8

"""
Copyright 2017 Square, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from pprint import pformat
from six import iteritems
import re


class CatalogQuery(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, sorted_attribute_query=None, exact_query=None, prefix_query=None, range_query=None, text_query=None, items_for_tax_query=None, items_for_modifier_list_query=None):
        """
        CatalogQuery - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'sorted_attribute_query': 'CatalogQuerySortedAttribute',
            'exact_query': 'CatalogQueryExact',
            'prefix_query': 'CatalogQueryPrefix',
            'range_query': 'CatalogQueryRange',
            'text_query': 'CatalogQueryText',
            'items_for_tax_query': 'CatalogQueryItemsForTax',
            'items_for_modifier_list_query': 'CatalogQueryItemsForModifierList'
        }

        self.attribute_map = {
            'sorted_attribute_query': 'sorted_attribute_query',
            'exact_query': 'exact_query',
            'prefix_query': 'prefix_query',
            'range_query': 'range_query',
            'text_query': 'text_query',
            'items_for_tax_query': 'items_for_tax_query',
            'items_for_modifier_list_query': 'items_for_modifier_list_query'
        }

        self._sorted_attribute_query = sorted_attribute_query
        self._exact_query = exact_query
        self._prefix_query = prefix_query
        self._range_query = range_query
        self._text_query = text_query
        self._items_for_tax_query = items_for_tax_query
        self._items_for_modifier_list_query = items_for_modifier_list_query

    @property
    def sorted_attribute_query(self):
        """
        Gets the sorted_attribute_query of this CatalogQuery.
        A query that returns all objects, sorted by the given attribute.

        :return: The sorted_attribute_query of this CatalogQuery.
        :rtype: CatalogQuerySortedAttribute
        """
        return self._sorted_attribute_query

    @sorted_attribute_query.setter
    def sorted_attribute_query(self, sorted_attribute_query):
        """
        Sets the sorted_attribute_query of this CatalogQuery.
        A query that returns all objects, sorted by the given attribute.

        :param sorted_attribute_query: The sorted_attribute_query of this CatalogQuery.
        :type: CatalogQuerySortedAttribute
        """

        self._sorted_attribute_query = sorted_attribute_query

    @property
    def exact_query(self):
        """
        Gets the exact_query of this CatalogQuery.
        A query that returns only objects for which the given (string-valued) attribute has the given case-insensitive value.

        :return: The exact_query of this CatalogQuery.
        :rtype: CatalogQueryExact
        """
        return self._exact_query

    @exact_query.setter
    def exact_query(self, exact_query):
        """
        Sets the exact_query of this CatalogQuery.
        A query that returns only objects for which the given (string-valued) attribute has the given case-insensitive value.

        :param exact_query: The exact_query of this CatalogQuery.
        :type: CatalogQueryExact
        """

        self._exact_query = exact_query

    @property
    def prefix_query(self):
        """
        Gets the prefix_query of this CatalogQuery.
        A query that returns only objects for which the given (string-valued) attribute has the given case-insensitive prefix.

        :return: The prefix_query of this CatalogQuery.
        :rtype: CatalogQueryPrefix
        """
        return self._prefix_query

    @prefix_query.setter
    def prefix_query(self, prefix_query):
        """
        Sets the prefix_query of this CatalogQuery.
        A query that returns only objects for which the given (string-valued) attribute has the given case-insensitive prefix.

        :param prefix_query: The prefix_query of this CatalogQuery.
        :type: CatalogQueryPrefix
        """

        self._prefix_query = prefix_query

    @property
    def range_query(self):
        """
        Gets the range_query of this CatalogQuery.
        A query that returns only objects for which the given (integer-valued) attribute lies in the given range.

        :return: The range_query of this CatalogQuery.
        :rtype: CatalogQueryRange
        """
        return self._range_query

    @range_query.setter
    def range_query(self, range_query):
        """
        Sets the range_query of this CatalogQuery.
        A query that returns only objects for which the given (integer-valued) attribute lies in the given range.

        :param range_query: The range_query of this CatalogQuery.
        :type: CatalogQueryRange
        """

        self._range_query = range_query

    @property
    def text_query(self):
        """
        Gets the text_query of this CatalogQuery.
        A query that returns only objects whose searchable attributes contain all of the given keywords as prefixes. For example, if a [CatalogItem](#type-catalogitem) contains attributes `{\"name\": \"t-shirt\"}` and `{\"description\": \"Small, Purple\"}`, it will be matched by the query `{\"keywords\": [\"shirt\", \"sma\", \"purp\"]}`.

        :return: The text_query of this CatalogQuery.
        :rtype: CatalogQueryText
        """
        return self._text_query

    @text_query.setter
    def text_query(self, text_query):
        """
        Sets the text_query of this CatalogQuery.
        A query that returns only objects whose searchable attributes contain all of the given keywords as prefixes. For example, if a [CatalogItem](#type-catalogitem) contains attributes `{\"name\": \"t-shirt\"}` and `{\"description\": \"Small, Purple\"}`, it will be matched by the query `{\"keywords\": [\"shirt\", \"sma\", \"purp\"]}`.

        :param text_query: The text_query of this CatalogQuery.
        :type: CatalogQueryText
        """

        self._text_query = text_query

    @property
    def items_for_tax_query(self):
        """
        Gets the items_for_tax_query of this CatalogQuery.
        A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogTax](#type-catalogtax)es enabled.

        :return: The items_for_tax_query of this CatalogQuery.
        :rtype: CatalogQueryItemsForTax
        """
        return self._items_for_tax_query

    @items_for_tax_query.setter
    def items_for_tax_query(self, items_for_tax_query):
        """
        Sets the items_for_tax_query of this CatalogQuery.
        A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogTax](#type-catalogtax)es enabled.

        :param items_for_tax_query: The items_for_tax_query of this CatalogQuery.
        :type: CatalogQueryItemsForTax
        """

        self._items_for_tax_query = items_for_tax_query

    @property
    def items_for_modifier_list_query(self):
        """
        Gets the items_for_modifier_list_query of this CatalogQuery.
        A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogModifierList](#type-catalogmodifierlist)s enabled.

        :return: The items_for_modifier_list_query of this CatalogQuery.
        :rtype: CatalogQueryItemsForModifierList
        """
        return self._items_for_modifier_list_query

    @items_for_modifier_list_query.setter
    def items_for_modifier_list_query(self, items_for_modifier_list_query):
        """
        Sets the items_for_modifier_list_query of this CatalogQuery.
        A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogModifierList](#type-catalogmodifierlist)s enabled.

        :param items_for_modifier_list_query: The items_for_modifier_list_query of this CatalogQuery.
        :type: CatalogQueryItemsForModifierList
        """

        self._items_for_modifier_list_query = items_for_modifier_list_query

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

        for attr, _ in 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

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return 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
        """
        return self.__dict__ == other.__dict__

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