<?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\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * The request for
 * [Firestore.ExecutePipeline][google.firestore.v1.Firestore.ExecutePipeline].
 *
 * Generated from protobuf message <code>google.firestore.v1.ExecutePipelineRequest</code>
 */
class ExecutePipelineRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Database identifier, in the form
     * `projects/{project}/databases/{database}`.
     *
     * Generated from protobuf field <code>string database = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $database = '';
    protected $pipeline_type;
    protected $consistency_selector;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $database
     *           Required. Database identifier, in the form
     *           `projects/{project}/databases/{database}`.
     *     @type \Google\Cloud\Firestore\V1\StructuredPipeline $structured_pipeline
     *           A pipelined operation.
     *     @type string $transaction
     *           Run the query within an already active transaction.
     *           The value here is the opaque transaction ID to execute the query in.
     *     @type \Google\Cloud\Firestore\V1\TransactionOptions $new_transaction
     *           Execute the pipeline in a new transaction.
     *           The identifier of the newly created transaction will be returned in the
     *           first response on the stream. This defaults to a read-only transaction.
     *     @type \Google\Protobuf\Timestamp $read_time
     *           Execute the pipeline in a snapshot transaction at the given time.
     *           This must be a microsecond precision timestamp within the past one hour,
     *           or if Point-in-Time Recovery is enabled, can additionally be a whole
     *           minute timestamp within the past 7 days.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Database identifier, in the form
     * `projects/{project}/databases/{database}`.
     *
     * Generated from protobuf field <code>string database = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getDatabase()
    {
        return $this->database;
    }

    /**
     * Required. Database identifier, in the form
     * `projects/{project}/databases/{database}`.
     *
     * 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;
    }

    /**
     * A pipelined operation.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredPipeline structured_pipeline = 2;</code>
     * @return \Google\Cloud\Firestore\V1\StructuredPipeline|null
     */
    public function getStructuredPipeline()
    {
        return $this->readOneof(2);
    }

    public function hasStructuredPipeline()
    {
        return $this->hasOneof(2);
    }

    /**
     * A pipelined operation.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredPipeline structured_pipeline = 2;</code>
     * @param \Google\Cloud\Firestore\V1\StructuredPipeline $var
     * @return $this
     */
    public function setStructuredPipeline($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredPipeline::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Run the query within an already active transaction.
     * The value here is the opaque transaction ID to execute the query in.
     *
     * Generated from protobuf field <code>bytes transaction = 5;</code>
     * @return string
     */
    public function getTransaction()
    {
        return $this->readOneof(5);
    }

    public function hasTransaction()
    {
        return $this->hasOneof(5);
    }

    /**
     * Run the query within an already active transaction.
     * The value here is the opaque transaction ID to execute the query in.
     *
     * Generated from protobuf field <code>bytes transaction = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setTransaction($var)
    {
        GPBUtil::checkString($var, False);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Execute the pipeline in a new transaction.
     * The identifier of the newly created transaction will be returned in the
     * first response on the stream. This defaults to a read-only transaction.
     *
     * Generated from protobuf field <code>.google.firestore.v1.TransactionOptions new_transaction = 6;</code>
     * @return \Google\Cloud\Firestore\V1\TransactionOptions|null
     */
    public function getNewTransaction()
    {
        return $this->readOneof(6);
    }

    public function hasNewTransaction()
    {
        return $this->hasOneof(6);
    }

    /**
     * Execute the pipeline in a new transaction.
     * The identifier of the newly created transaction will be returned in the
     * first response on the stream. This defaults to a read-only transaction.
     *
     * Generated from protobuf field <code>.google.firestore.v1.TransactionOptions new_transaction = 6;</code>
     * @param \Google\Cloud\Firestore\V1\TransactionOptions $var
     * @return $this
     */
    public function setNewTransaction($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Execute the pipeline in a snapshot transaction at the given time.
     * This must be a microsecond precision timestamp within the past one hour,
     * or if Point-in-Time Recovery is enabled, can additionally be a whole
     * minute timestamp within the past 7 days.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp read_time = 7;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getReadTime()
    {
        return $this->readOneof(7);
    }

    public function hasReadTime()
    {
        return $this->hasOneof(7);
    }

    /**
     * Execute the pipeline in a snapshot transaction at the given time.
     * This must be a microsecond precision timestamp within the past one hour,
     * or if Point-in-Time Recovery is enabled, can additionally be a whole
     * minute timestamp within the past 7 days.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp read_time = 7;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setReadTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getPipelineType()
    {
        return $this->whichOneof("pipeline_type");
    }

    /**
     * @return string
     */
    public function getConsistencySelector()
    {
        return $this->whichOneof("consistency_selector");
    }

}

