<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/datastore/v1/query_profile.proto

namespace Google\Cloud\Datastore\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Execution statistics for the query.
 *
 * Generated from protobuf message <code>google.datastore.v1.ExecutionStats</code>
 */
class ExecutionStats extends \Google\Protobuf\Internal\Message
{
    /**
     * Total number of results returned, including documents, projections,
     * aggregation results, keys.
     *
     * Generated from protobuf field <code>int64 results_returned = 1;</code>
     */
    private $results_returned = 0;
    /**
     * Total time to execute the query in the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration execution_duration = 3;</code>
     */
    private $execution_duration = null;
    /**
     * Total billable read operations.
     *
     * Generated from protobuf field <code>int64 read_operations = 4;</code>
     */
    private $read_operations = 0;
    /**
     * Debugging statistics from the execution of the query. Note that the
     * debugging stats are subject to change as Firestore evolves. It could
     * include:
     *  {
     *    "indexes_entries_scanned": "1000",
     *    "documents_scanned": "20",
     *    "billing_details" : {
     *       "documents_billable": "20",
     *       "index_entries_billable": "1000",
     *       "min_query_cost": "0"
     *    }
     *  }
     *
     * Generated from protobuf field <code>.google.protobuf.Struct debug_stats = 5;</code>
     */
    private $debug_stats = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $results_returned
     *           Total number of results returned, including documents, projections,
     *           aggregation results, keys.
     *     @type \Google\Protobuf\Duration $execution_duration
     *           Total time to execute the query in the backend.
     *     @type int|string $read_operations
     *           Total billable read operations.
     *     @type \Google\Protobuf\Struct $debug_stats
     *           Debugging statistics from the execution of the query. Note that the
     *           debugging stats are subject to change as Firestore evolves. It could
     *           include:
     *            {
     *              "indexes_entries_scanned": "1000",
     *              "documents_scanned": "20",
     *              "billing_details" : {
     *                 "documents_billable": "20",
     *                 "index_entries_billable": "1000",
     *                 "min_query_cost": "0"
     *              }
     *            }
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
        parent::__construct($data);
    }

    /**
     * Total number of results returned, including documents, projections,
     * aggregation results, keys.
     *
     * Generated from protobuf field <code>int64 results_returned = 1;</code>
     * @return int|string
     */
    public function getResultsReturned()
    {
        return $this->results_returned;
    }

    /**
     * Total number of results returned, including documents, projections,
     * aggregation results, keys.
     *
     * Generated from protobuf field <code>int64 results_returned = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setResultsReturned($var)
    {
        GPBUtil::checkInt64($var);
        $this->results_returned = $var;

        return $this;
    }

    /**
     * Total time to execute the query in the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration execution_duration = 3;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getExecutionDuration()
    {
        return $this->execution_duration;
    }

    public function hasExecutionDuration()
    {
        return isset($this->execution_duration);
    }

    public function clearExecutionDuration()
    {
        unset($this->execution_duration);
    }

    /**
     * Total time to execute the query in the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration execution_duration = 3;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setExecutionDuration($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->execution_duration = $var;

        return $this;
    }

    /**
     * Total billable read operations.
     *
     * Generated from protobuf field <code>int64 read_operations = 4;</code>
     * @return int|string
     */
    public function getReadOperations()
    {
        return $this->read_operations;
    }

    /**
     * Total billable read operations.
     *
     * Generated from protobuf field <code>int64 read_operations = 4;</code>
     * @param int|string $var
     * @return $this
     */
    public function setReadOperations($var)
    {
        GPBUtil::checkInt64($var);
        $this->read_operations = $var;

        return $this;
    }

    /**
     * Debugging statistics from the execution of the query. Note that the
     * debugging stats are subject to change as Firestore evolves. It could
     * include:
     *  {
     *    "indexes_entries_scanned": "1000",
     *    "documents_scanned": "20",
     *    "billing_details" : {
     *       "documents_billable": "20",
     *       "index_entries_billable": "1000",
     *       "min_query_cost": "0"
     *    }
     *  }
     *
     * Generated from protobuf field <code>.google.protobuf.Struct debug_stats = 5;</code>
     * @return \Google\Protobuf\Struct|null
     */
    public function getDebugStats()
    {
        return $this->debug_stats;
    }

    public function hasDebugStats()
    {
        return isset($this->debug_stats);
    }

    public function clearDebugStats()
    {
        unset($this->debug_stats);
    }

    /**
     * Debugging statistics from the execution of the query. Note that the
     * debugging stats are subject to change as Firestore evolves. It could
     * include:
     *  {
     *    "indexes_entries_scanned": "1000",
     *    "documents_scanned": "20",
     *    "billing_details" : {
     *       "documents_billable": "20",
     *       "index_entries_billable": "1000",
     *       "min_query_cost": "0"
     *    }
     *  }
     *
     * Generated from protobuf field <code>.google.protobuf.Struct debug_stats = 5;</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setDebugStats($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->debug_stats = $var;

        return $this;
    }

}

