# coding: utf-8

"""
    REST API

    Rockset's REST API allows for creating and managing all resources in Rockset. Each supported endpoint is documented below.  All requests must be authorized with a Rockset API key, which can be created in the [Rockset console](https://console.rockset.com). The API key must be provided as `ApiKey <api_key>` in the `Authorization` request header. For example: ``` Authorization: ApiKey aB35kDjg93J5nsf4GjwMeErAVd832F7ad4vhsW1S02kfZiab42sTsfW5Sxt25asT ```  All endpoints are only accessible via https.  Build something awesome!  # noqa: E501

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


import pprint
import re  # noqa: F401

import six

from rockset.swagger_client.models.operator_stats import OperatorStats  # noqa: F401,E501


class QueryResponseStats(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 = {
        'elapsed_time_ms': 'int',
        'rows_scanned': 'int',
        'rows_returned': 'int',
        'operators': 'list[OperatorStats]',
        'execution_graph': 'str',
        'execution_plan': 'str',
        'query_text': 'str'
    }

    attribute_map = {
        'elapsed_time_ms': 'elapsed_time_ms',
        'rows_scanned': 'rows_scanned',
        'rows_returned': 'rows_returned',
        'operators': 'operators',
        'execution_graph': 'execution_graph',
        'execution_plan': 'execution_plan',
        'query_text': 'query_text'
    }

    def __init__(self, **kwargs):  # noqa: E501
        """QueryResponseStats - a model defined in Swagger"""  # noqa: E501

        self._elapsed_time_ms = None
        self._rows_scanned = None
        self._rows_returned = None
        self._operators = None
        self._execution_graph = None
        self._execution_plan = None
        self._query_text = None
        self.discriminator = None

        self.elapsed_time_ms = kwargs.pop('elapsed_time_ms', None)
        self.rows_scanned = kwargs.pop('rows_scanned', None)
        self.rows_returned = kwargs.pop('rows_returned', None)
        self.operators = kwargs.pop('operators', None)
        self.execution_graph = kwargs.pop('execution_graph', None)
        self.execution_plan = kwargs.pop('execution_plan', None)
        self.query_text = kwargs.pop('query_text', None)

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

        query time in milliseconds  # noqa: E501

        :return: The elapsed_time_ms of this QueryResponseStats.  # noqa: E501
        :rtype: int
        """
        return self._elapsed_time_ms

    @elapsed_time_ms.setter
    def elapsed_time_ms(self, elapsed_time_ms):
        """Sets the elapsed_time_ms of this QueryResponseStats.

        query time in milliseconds  # noqa: E501

        :param elapsed_time_ms: The elapsed_time_ms of this QueryResponseStats.  # noqa: E501
        :type: int
        """

        self._elapsed_time_ms = elapsed_time_ms

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

        rows scanned as part of query execution  # noqa: E501

        :return: The rows_scanned of this QueryResponseStats.  # noqa: E501
        :rtype: int
        """
        return self._rows_scanned

    @rows_scanned.setter
    def rows_scanned(self, rows_scanned):
        """Sets the rows_scanned of this QueryResponseStats.

        rows scanned as part of query execution  # noqa: E501

        :param rows_scanned: The rows_scanned of this QueryResponseStats.  # noqa: E501
        :type: int
        """

        self._rows_scanned = rows_scanned

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

        number of rows returned from the query  # noqa: E501

        :return: The rows_returned of this QueryResponseStats.  # noqa: E501
        :rtype: int
        """
        return self._rows_returned

    @rows_returned.setter
    def rows_returned(self, rows_returned):
        """Sets the rows_returned of this QueryResponseStats.

        number of rows returned from the query  # noqa: E501

        :param rows_returned: The rows_returned of this QueryResponseStats.  # noqa: E501
        :type: int
        """

        self._rows_returned = rows_returned

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

        Statistics for each operator from query execution  # noqa: E501

        :return: The operators of this QueryResponseStats.  # noqa: E501
        :rtype: list[OperatorStats]
        """
        return self._operators

    @operators.setter
    def operators(self, operators):
        """Sets the operators of this QueryResponseStats.

        Statistics for each operator from query execution  # noqa: E501

        :param operators: The operators of this QueryResponseStats.  # noqa: E501
        :type: list[OperatorStats]
        """

        self._operators = operators

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

        DOT graph representing the execution steps of this query  # noqa: E501

        :return: The execution_graph of this QueryResponseStats.  # noqa: E501
        :rtype: str
        """
        return self._execution_graph

    @execution_graph.setter
    def execution_graph(self, execution_graph):
        """Sets the execution_graph of this QueryResponseStats.

        DOT graph representing the execution steps of this query  # noqa: E501

        :param execution_graph: The execution_graph of this QueryResponseStats.  # noqa: E501
        :type: str
        """

        self._execution_graph = execution_graph

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

        Execution plan (output of EXPLAIN) of this query  # noqa: E501

        :return: The execution_plan of this QueryResponseStats.  # noqa: E501
        :rtype: str
        """
        return self._execution_plan

    @execution_plan.setter
    def execution_plan(self, execution_plan):
        """Sets the execution_plan of this QueryResponseStats.

        Execution plan (output of EXPLAIN) of this query  # noqa: E501

        :param execution_plan: The execution_plan of this QueryResponseStats.  # noqa: E501
        :type: str
        """

        self._execution_plan = execution_plan

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

        SQL text of Query that was executed  # noqa: E501

        :return: The query_text of this QueryResponseStats.  # noqa: E501
        :rtype: str
        """
        return self._query_text

    @query_text.setter
    def query_text(self, query_text):
        """Sets the query_text of this QueryResponseStats.

        SQL text of Query that was executed  # noqa: E501

        :param query_text: The query_text of this QueryResponseStats.  # noqa: E501
        :type: str
        """

        self._query_text = query_text

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

        return self.__dict__ == other.__dict__

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

    def __getitem__(self, item):
        return getattr(self, item)

    def get(self, item):
        return getattr(self, item)

    def items(self):
        return self.to_dict().items()

    def __setitem__(self, item, value):
        return seattr(self, item, value)
