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

namespace Google\Cloud\Firestore\V1\StructuredQuery;

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

/**
 * The projection of document's fields to return.
 *
 * Generated from protobuf message <code>google.firestore.v1.StructuredQuery.Projection</code>
 */
class Projection extends \Google\Protobuf\Internal\Message
{
    /**
     * The fields to return.
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    private $fields;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[] $fields
     *           The fields to return.
     *           If empty, all fields are returned. To only return the name
     *           of the document, use `['__name__']`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Query::initOnce();
        parent::__construct($data);
    }

    /**
     * The fields to return.
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     * @return RepeatedField<\Google\Cloud\Firestore\V1\StructuredQuery\FieldReference>
     */
    public function getFields()
    {
        return $this->fields;
    }

    /**
     * The fields to return.
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[] $var
     * @return $this
     */
    public function setFields($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference::class);
        $this->fields = $arr;

        return $this;
    }

}

