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

namespace Google\Cloud\Firestore\V1;

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

/**
 * The result of a single bucket from a Firestore aggregation query.
 * The keys of `aggregate_fields` are the same for all results in an aggregation
 * query, unlike document queries which can have different fields present for
 * each result.
 *
 * Generated from protobuf message <code>google.firestore.v1.AggregationResult</code>
 */
class AggregationResult extends \Google\Protobuf\Internal\Message
{
    /**
     * The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
     * The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
     * assigned to the aggregation function on input and the size of this map
     * equals the number of aggregation functions in the query.
     *
     * Generated from protobuf field <code>map<string, .google.firestore.v1.Value> aggregate_fields = 2;</code>
     */
    private $aggregate_fields;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array|\Google\Protobuf\Internal\MapField $aggregate_fields
     *           The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
     *           The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
     *           assigned to the aggregation function on input and the size of this map
     *           equals the number of aggregation functions in the query.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\AggregationResult::initOnce();
        parent::__construct($data);
    }

    /**
     * The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
     * The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
     * assigned to the aggregation function on input and the size of this map
     * equals the number of aggregation functions in the query.
     *
     * Generated from protobuf field <code>map<string, .google.firestore.v1.Value> aggregate_fields = 2;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getAggregateFields()
    {
        return $this->aggregate_fields;
    }

    /**
     * The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
     * The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
     * assigned to the aggregation function on input and the size of this map
     * equals the number of aggregation functions in the query.
     *
     * Generated from protobuf field <code>map<string, .google.firestore.v1.Value> aggregate_fields = 2;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setAggregateFields($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
        $this->aggregate_fields = $arr;

        return $this;
    }

}

