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

namespace Google\Cloud\Firestore\V1;

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

/**
 * The request for [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].
 *
 * Generated from protobuf message <code>google.firestore.v1.BatchWriteRequest</code>
 */
class BatchWriteRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The database name. In the format:
     * `projects/{project_id}/databases/{database_id}`.
     *
     * Generated from protobuf field <code>string database = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $database = '';
    /**
     * The writes to apply.
     * Method does not apply writes atomically and does not guarantee ordering.
     * Each write succeeds or fails independently. You cannot write to the same
     * document more than once per request.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.Write writes = 2;</code>
     */
    private $writes;
    /**
     * Labels associated with this batch write.
     *
     * Generated from protobuf field <code>map<string, string> labels = 3;</code>
     */
    private $labels;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $database
     *           Required. The database name. In the format:
     *           `projects/{project_id}/databases/{database_id}`.
     *     @type array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $writes
     *           The writes to apply.
     *           Method does not apply writes atomically and does not guarantee ordering.
     *           Each write succeeds or fails independently. You cannot write to the same
     *           document more than once per request.
     *     @type array|\Google\Protobuf\Internal\MapField $labels
     *           Labels associated with this batch write.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The database name. In the format:
     * `projects/{project_id}/databases/{database_id}`.
     *
     * Generated from protobuf field <code>string database = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getDatabase()
    {
        return $this->database;
    }

    /**
     * Required. The database name. In the format:
     * `projects/{project_id}/databases/{database_id}`.
     *
     * Generated from protobuf field <code>string database = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setDatabase($var)
    {
        GPBUtil::checkString($var, True);
        $this->database = $var;

        return $this;
    }

    /**
     * The writes to apply.
     * Method does not apply writes atomically and does not guarantee ordering.
     * Each write succeeds or fails independently. You cannot write to the same
     * document more than once per request.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.Write writes = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getWrites()
    {
        return $this->writes;
    }

    /**
     * The writes to apply.
     * Method does not apply writes atomically and does not guarantee ordering.
     * Each write succeeds or fails independently. You cannot write to the same
     * document more than once per request.
     *
     * Generated from protobuf field <code>repeated .google.firestore.v1.Write writes = 2;</code>
     * @param array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setWrites($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Write::class);
        $this->writes = $arr;

        return $this;
    }

    /**
     * Labels associated with this batch write.
     *
     * Generated from protobuf field <code>map<string, string> labels = 3;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLabels()
    {
        return $this->labels;
    }

    /**
     * Labels associated with this batch write.
     *
     * Generated from protobuf field <code>map<string, string> labels = 3;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLabels($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->labels = $arr;

        return $this;
    }

}

