# 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.pagination import Pagination  # noqa: F401,E501
from rockset.swagger_client.models.query_error import QueryError  # noqa: F401,E501
from rockset.swagger_client.models.stats import Stats  # noqa: F401,E501


class QueryInfo(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_id': 'str',
        'status': 'str',
        'executed_by': 'str',
        'submitted_at': 'str',
        'expires_at': 'str',
        'stats': 'Stats',
        'pagination': 'Pagination',
        'last_offset': 'str',
        'query_errors': 'list[QueryError]'
    }

    attribute_map = {
        'query_id': 'query_id',
        'status': 'status',
        'executed_by': 'executed_by',
        'submitted_at': 'submitted_at',
        'expires_at': 'expires_at',
        'stats': 'stats',
        'pagination': 'pagination',
        'last_offset': 'last_offset',
        'query_errors': 'query_errors'
    }

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

        self._query_id = None
        self._status = None
        self._executed_by = None
        self._submitted_at = None
        self._expires_at = None
        self._stats = None
        self._pagination = None
        self._last_offset = None
        self._query_errors = None
        self.discriminator = None

        self.query_id = kwargs.pop('query_id', None)
        self.status = kwargs.pop('status', None)
        self.executed_by = kwargs.pop('executed_by', None)
        self.submitted_at = kwargs.pop('submitted_at', None)
        self.expires_at = kwargs.pop('expires_at', None)
        self.stats = kwargs.pop('stats', None)
        self.pagination = kwargs.pop('pagination', None)
        self.last_offset = kwargs.pop('last_offset', None)
        self.query_errors = kwargs.pop('query_errors', None)

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

        Unique Query ID.  # noqa: E501

        :return: The query_id of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._query_id

    @query_id.setter
    def query_id(self, query_id):
        """Sets the query_id of this QueryInfo.

        Unique Query ID.  # noqa: E501

        :param query_id: The query_id of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._query_id = query_id

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

        Status of the query.  # noqa: E501

        :return: The status of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, status):
        """Sets the status of this QueryInfo.

        Status of the query.  # noqa: E501

        :param status: The status of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._status = status

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

        User ID who executed the query  # noqa: E501

        :return: The executed_by of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._executed_by

    @executed_by.setter
    def executed_by(self, executed_by):
        """Sets the executed_by of this QueryInfo.

        User ID who executed the query  # noqa: E501

        :param executed_by: The executed_by of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._executed_by = executed_by

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

        Time (UTC) the query request was first received and queued for execution.  # noqa: E501

        :return: The submitted_at of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._submitted_at

    @submitted_at.setter
    def submitted_at(self, submitted_at):
        """Sets the submitted_at of this QueryInfo.

        Time (UTC) the query request was first received and queued for execution.  # noqa: E501

        :param submitted_at: The submitted_at of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._submitted_at = submitted_at

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

        Time (UTC) that query results expire. Only populated if `status` is `COMPLETE`.  # noqa: E501

        :return: The expires_at of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._expires_at

    @expires_at.setter
    def expires_at(self, expires_at):
        """Sets the expires_at of this QueryInfo.

        Time (UTC) that query results expire. Only populated if `status` is `COMPLETE`.  # noqa: E501

        :param expires_at: The expires_at of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._expires_at = expires_at

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

        Various stats about the query's execution.  # noqa: E501

        :return: The stats of this QueryInfo.  # noqa: E501
        :rtype: Stats
        """
        return self._stats

    @stats.setter
    def stats(self, stats):
        """Sets the stats of this QueryInfo.

        Various stats about the query's execution.  # noqa: E501

        :param stats: The stats of this QueryInfo.  # noqa: E501
        :type: Stats
        """

        self._stats = stats

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

        Information for fetching query results pages. Only populated if `status` is `COMPLETE`.  # noqa: E501

        :return: The pagination of this QueryInfo.  # noqa: E501
        :rtype: Pagination
        """
        return self._pagination

    @pagination.setter
    def pagination(self, pagination):
        """Sets the pagination of this QueryInfo.

        Information for fetching query results pages. Only populated if `status` is `COMPLETE`.  # noqa: E501

        :param pagination: The pagination of this QueryInfo.  # noqa: E501
        :type: Pagination
        """

        self._pagination = pagination

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

        The log offset that query results were written to in the destination collection. Only populated for INSERT INTO queries.  # noqa: E501

        :return: The last_offset of this QueryInfo.  # noqa: E501
        :rtype: str
        """
        return self._last_offset

    @last_offset.setter
    def last_offset(self, last_offset):
        """Sets the last_offset of this QueryInfo.

        The log offset that query results were written to in the destination collection. Only populated for INSERT INTO queries.  # noqa: E501

        :param last_offset: The last_offset of this QueryInfo.  # noqa: E501
        :type: str
        """

        self._last_offset = last_offset

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

        Errors encountered while executing the query.  # noqa: E501

        :return: The query_errors of this QueryInfo.  # noqa: E501
        :rtype: list[QueryError]
        """
        return self._query_errors

    @query_errors.setter
    def query_errors(self, query_errors):
        """Sets the query_errors of this QueryInfo.

        Errors encountered while executing the query.  # noqa: E501

        :param query_errors: The query_errors of this QueryInfo.  # noqa: E501
        :type: list[QueryError]
        """

        self._query_errors = query_errors

    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(QueryInfo, 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, QueryInfo):
            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)
