# coding: utf-8

"""
    Paragon Insights APIs

    API interface for PI application  # noqa: E501

    OpenAPI spec version: 4.0.0
    Contact: healthbot-feedback@juniper.net
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six


class TsdbPostBodyItems(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 = {
        'query_name': 'str',
        'device_group': 'str',
        'device': 'str',
        'db': 'str',
        'topic': 'str',
        'rule': 'str',
        'trigger': 'str',
        'measurement': 'str',
        'where': 'str',
        'order': 'str',
        'limit': 'int',
        'fields': 'list[str]',
        'group_by': 'list[str]',
        'outer_queries': 'list[TsdbPostBodyItemsOuterQueries]',
        'device_aggregation': 'TsdbPostBodyItemsDeviceAggregation'
    }

    attribute_map = {
        'query_name': 'queryName',
        'device_group': 'deviceGroup',
        'device': 'device',
        'db': 'db',
        'topic': 'topic',
        'rule': 'rule',
        'trigger': 'trigger',
        'measurement': 'measurement',
        'where': 'where',
        'order': 'order',
        'limit': 'limit',
        'fields': 'fields',
        'group_by': 'GroupBy',
        'outer_queries': 'outerQueries',
        'device_aggregation': 'deviceAggregation'
    }

    def __init__(self, query_name=None, device_group=None, device=None, db=None, topic=None, rule=None, trigger=None, measurement=None, where=None, order=None, limit=None, fields=None, group_by=None, outer_queries=None, device_aggregation=None):  # noqa: E501
        """TsdbPostBodyItems - a model defined in Swagger"""  # noqa: E501

        self._query_name = None
        self._device_group = None
        self._device = None
        self._db = None
        self._topic = None
        self._rule = None
        self._trigger = None
        self._measurement = None
        self._where = None
        self._order = None
        self._limit = None
        self._fields = None
        self._group_by = None
        self._outer_queries = None
        self._device_aggregation = None
        self.discriminator = None

        if query_name is not None:
            self.query_name = query_name
        if device_group is not None:
            self.device_group = device_group
        if device is not None:
            self.device = device
        if db is not None:
            self.db = db
        if topic is not None:
            self.topic = topic
        if rule is not None:
            self.rule = rule
        if trigger is not None:
            self.trigger = trigger
        if measurement is not None:
            self.measurement = measurement
        if where is not None:
            self.where = where
        if order is not None:
            self.order = order
        if limit is not None:
            self.limit = limit
        if fields is not None:
            self.fields = fields
        if group_by is not None:
            self.group_by = group_by
        if outer_queries is not None:
            self.outer_queries = outer_queries
        if device_aggregation is not None:
            self.device_aggregation = device_aggregation

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

        Name of the query object. Optional. Not used for now  # noqa: E501

        :return: The query_name of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._query_name

    @query_name.setter
    def query_name(self, query_name):
        """Sets the query_name of this TsdbPostBodyItems.

        Name of the query object. Optional. Not used for now  # noqa: E501

        :param query_name: The query_name of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._query_name = query_name

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

        Name of the deviceGroup(s). Multiple device groups should be separated by ','. This can be used in combination with device, but is not mandatory. If device is given, then query will be executed only for that particular devices in the given device group, else all devices in group will be considered. Given devices will be applicable for all give device-groups.  # noqa: E501

        :return: The device_group of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._device_group

    @device_group.setter
    def device_group(self, device_group):
        """Sets the device_group of this TsdbPostBodyItems.

        Name of the deviceGroup(s). Multiple device groups should be separated by ','. This can be used in combination with device, but is not mandatory. If device is given, then query will be executed only for that particular devices in the given device group, else all devices in group will be considered. Given devices will be applicable for all give device-groups.  # noqa: E501

        :param device_group: The device_group of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._device_group = device_group

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

        Name of the device. Multiple device should be separated by ','. This should be used along with deviceGroup. Without deviceGroup, this config will not be considered  # noqa: E501

        :return: The device of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._device

    @device.setter
    def device(self, device):
        """Sets the device of this TsdbPostBodyItems.

        Name of the device. Multiple device should be separated by ','. This should be used along with deviceGroup. Without deviceGroup, this config will not be considered  # noqa: E501

        :param device: The device of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._device = device

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

        Name of the database. Multiple databases should be separated by ','. '*' can be used to specify all databases.  # noqa: E501

        :return: The db of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._db

    @db.setter
    def db(self, db):
        """Sets the db of this TsdbPostBodyItems.

        Name of the database. Multiple databases should be separated by ','. '*' can be used to specify all databases.  # noqa: E501

        :param db: The db of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._db = db

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

        Name of Healthbot topic. Optional if measurement is used  # noqa: E501

        :return: The topic of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._topic

    @topic.setter
    def topic(self, topic):
        """Sets the topic of this TsdbPostBodyItems.

        Name of Healthbot topic. Optional if measurement is used  # noqa: E501

        :param topic: The topic of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._topic = topic

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

        Name of Healthbot rule. Required if topic is used. Optional if measurement is used  # noqa: E501

        :return: The rule of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._rule

    @rule.setter
    def rule(self, rule):
        """Sets the rule of this TsdbPostBodyItems.

        Name of Healthbot rule. Required if topic is used. Optional if measurement is used  # noqa: E501

        :param rule: The rule of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._rule = rule

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

        Name of Healthbot trigger. Optional if measurement is used or rule table is being queried  # noqa: E501

        :return: The trigger of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._trigger

    @trigger.setter
    def trigger(self, trigger):
        """Sets the trigger of this TsdbPostBodyItems.

        Name of Healthbot trigger. Optional if measurement is used or rule table is being queried  # noqa: E501

        :param trigger: The trigger of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._trigger = trigger

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

        Name of the measurement. Optional if topic/rule/trigger is used  # noqa: E501

        :return: The measurement of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._measurement

    @measurement.setter
    def measurement(self, measurement):
        """Sets the measurement of this TsdbPostBodyItems.

        Name of the measurement. Optional if topic/rule/trigger is used  # noqa: E501

        :param measurement: The measurement of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._measurement = measurement

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

        Where clause filters data based on fields, tags, and/or timestamps. Eg: where=\"interface-name\" = 'ge-0/0/1' and \"in-pkts\" > 0  # noqa: E501

        :return: The where of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._where

    @where.setter
    def where(self, where):
        """Sets the where of this TsdbPostBodyItems.

        Where clause filters data based on fields, tags, and/or timestamps. Eg: where=\"interface-name\" = 'ge-0/0/1' and \"in-pkts\" > 0  # noqa: E501

        :param where: The where of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._where = where

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

        Sort points in descending order based on time. By default points will be sorted in ascending order. Eg: order=desc  # noqa: E501

        :return: The order of this TsdbPostBodyItems.  # noqa: E501
        :rtype: str
        """
        return self._order

    @order.setter
    def order(self, order):
        """Sets the order of this TsdbPostBodyItems.

        Sort points in descending order based on time. By default points will be sorted in ascending order. Eg: order=desc  # noqa: E501

        :param order: The order of this TsdbPostBodyItems.  # noqa: E501
        :type: str
        """

        self._order = order

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

        Limit number of points in the result. If groupBy is used limit is applied per group. Eg: limit=10  # noqa: E501

        :return: The limit of this TsdbPostBodyItems.  # noqa: E501
        :rtype: int
        """
        return self._limit

    @limit.setter
    def limit(self, limit):
        """Sets the limit of this TsdbPostBodyItems.

        Limit number of points in the result. If groupBy is used limit is applied per group. Eg: limit=10  # noqa: E501

        :param limit: The limit of this TsdbPostBodyItems.  # noqa: E501
        :type: int
        """

        self._limit = limit

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


        :return: The fields of this TsdbPostBodyItems.  # noqa: E501
        :rtype: list[str]
        """
        return self._fields

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


        :param fields: The fields of this TsdbPostBodyItems.  # noqa: E501
        :type: list[str]
        """

        self._fields = fields

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


        :return: The group_by of this TsdbPostBodyItems.  # noqa: E501
        :rtype: list[str]
        """
        return self._group_by

    @group_by.setter
    def group_by(self, group_by):
        """Sets the group_by of this TsdbPostBodyItems.


        :param group_by: The group_by of this TsdbPostBodyItems.  # noqa: E501
        :type: list[str]
        """

        self._group_by = group_by

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


        :return: The outer_queries of this TsdbPostBodyItems.  # noqa: E501
        :rtype: list[TsdbPostBodyItemsOuterQueries]
        """
        return self._outer_queries

    @outer_queries.setter
    def outer_queries(self, outer_queries):
        """Sets the outer_queries of this TsdbPostBodyItems.


        :param outer_queries: The outer_queries of this TsdbPostBodyItems.  # noqa: E501
        :type: list[TsdbPostBodyItemsOuterQueries]
        """

        self._outer_queries = outer_queries

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


        :return: The device_aggregation of this TsdbPostBodyItems.  # noqa: E501
        :rtype: TsdbPostBodyItemsDeviceAggregation
        """
        return self._device_aggregation

    @device_aggregation.setter
    def device_aggregation(self, device_aggregation):
        """Sets the device_aggregation of this TsdbPostBodyItems.


        :param device_aggregation: The device_aggregation of this TsdbPostBodyItems.  # noqa: E501
        :type: TsdbPostBodyItemsDeviceAggregation
        """

        self._device_aggregation = device_aggregation

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

        return self.__dict__ == other.__dict__

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