# coding: utf-8

"""

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: v2
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class QuerySpec(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 = {
        'constant_score': 'bool',
        'fields': 'list[Path]',
        'conditions': 'list[QueryCondition]',
        'logical_operator': 'str',
        'sort_fields': 'list[SortField]',
        '_from': 'int',
        'size': 'int'
    }

    attribute_map = {
        'constant_score': 'constantScore',
        'fields': 'fields',
        'conditions': 'conditions',
        'logical_operator': 'logicalOperator',
        'sort_fields': 'sortFields',
        '_from': 'from',
        'size': 'size'
    }

    def __init__(self, constant_score=None, fields=None, conditions=None, logical_operator=None, sort_fields=None, _from=None, size=None):
        """
        QuerySpec - a model defined in Swagger
        """

        self._constant_score = None
        self._fields = None
        self._conditions = None
        self._logical_operator = None
        self._sort_fields = None
        self.__from = None
        self._size = None
        self.discriminator = None

        if constant_score is not None:
          self.constant_score = constant_score
        if fields is not None:
          self.fields = fields
        if conditions is not None:
          self.conditions = conditions
        if logical_operator is not None:
          self.logical_operator = logical_operator
        if sort_fields is not None:
          self.sort_fields = sort_fields
        if _from is not None:
          self._from = _from
        if size is not None:
          self.size = size

    @property
    def constant_score(self):
        """
        Gets the constant_score of this QuerySpec.

        :return: The constant_score of this QuerySpec.
        :rtype: bool
        """
        return self._constant_score

    @constant_score.setter
    def constant_score(self, constant_score):
        """
        Sets the constant_score of this QuerySpec.

        :param constant_score: The constant_score of this QuerySpec.
        :type: bool
        """

        self._constant_score = constant_score

    @property
    def fields(self):
        """
        Gets the fields of this QuerySpec.

        :return: The fields of this QuerySpec.
        :rtype: list[Path]
        """
        return self._fields

    @fields.setter
    def fields(self, fields):
        """
        Sets the fields of this QuerySpec.

        :param fields: The fields of this QuerySpec.
        :type: list[Path]
        """

        self._fields = fields

    @property
    def conditions(self):
        """
        Gets the conditions of this QuerySpec.

        :return: The conditions of this QuerySpec.
        :rtype: list[QueryCondition]
        """
        return self._conditions

    @conditions.setter
    def conditions(self, conditions):
        """
        Sets the conditions of this QuerySpec.

        :param conditions: The conditions of this QuerySpec.
        :type: list[QueryCondition]
        """

        self._conditions = conditions

    @property
    def logical_operator(self):
        """
        Gets the logical_operator of this QuerySpec.

        :return: The logical_operator of this QuerySpec.
        :rtype: str
        """
        return self._logical_operator

    @logical_operator.setter
    def logical_operator(self, logical_operator):
        """
        Sets the logical_operator of this QuerySpec.

        :param logical_operator: The logical_operator of this QuerySpec.
        :type: str
        """
        allowed_values = ["AND", "OR"]
        if logical_operator not in allowed_values:
            raise ValueError(
                "Invalid value for `logical_operator` ({0}), must be one of {1}"
                .format(logical_operator, allowed_values)
            )

        self._logical_operator = logical_operator

    @property
    def sort_fields(self):
        """
        Gets the sort_fields of this QuerySpec.

        :return: The sort_fields of this QuerySpec.
        :rtype: list[SortField]
        """
        return self._sort_fields

    @sort_fields.setter
    def sort_fields(self, sort_fields):
        """
        Sets the sort_fields of this QuerySpec.

        :param sort_fields: The sort_fields of this QuerySpec.
        :type: list[SortField]
        """

        self._sort_fields = sort_fields

    @property
    def _from(self):
        """
        Gets the _from of this QuerySpec.

        :return: The _from of this QuerySpec.
        :rtype: int
        """
        return self.__from

    @_from.setter
    def _from(self, _from):
        """
        Sets the _from of this QuerySpec.

        :param _from: The _from of this QuerySpec.
        :type: int
        """

        self.__from = _from

    @property
    def size(self):
        """
        Gets the size of this QuerySpec.

        :return: The size of this QuerySpec.
        :rtype: int
        """
        return self._size

    @size.setter
    def size(self, size):
        """
        Sets the size of this QuerySpec.

        :param size: The size of this QuerySpec.
        :type: int
        """

        self._size = size

    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
        """
        if not isinstance(other, QuerySpec):
            return False

        return self.__dict__ == other.__dict__

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