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

namespace Google\Cloud\Spanner\V1;

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

/**
 * The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]
 *
 * Generated from protobuf message <code>google.spanner.v1.ExecuteBatchDmlRequest</code>
 */
class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The session in which the DML statements should be performed.
     *
     * Generated from protobuf field <code>string session = 1;</code>
     */
    private $session = '';
    /**
     * The transaction to use. A ReadWrite transaction is required. Single-use
     * transactions are not supported (to avoid replay).  The caller must either
     * supply an existing transaction ID or begin a new transaction.
     *
     * Generated from protobuf field <code>.google.spanner.v1.TransactionSelector transaction = 2;</code>
     */
    private $transaction = null;
    /**
     * The list of statements to execute in this batch. Statements are executed
     * serially, such that the effects of statement i are visible to statement
     * i+1. Each statement must be a DML statement. Execution will stop at the
     * first failed statement; the remaining statements will not run.
     * REQUIRES: statements_size() > 0.
     *
     * Generated from protobuf field <code>repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3;</code>
     */
    private $statements;
    /**
     * A per-transaction sequence number used to identify this request. This is
     * used in the same space as the seqno in
     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
     *
     * Generated from protobuf field <code>int64 seqno = 4;</code>
     */
    private $seqno = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $session
     *           Required. The session in which the DML statements should be performed.
     *     @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction
     *           The transaction to use. A ReadWrite transaction is required. Single-use
     *           transactions are not supported (to avoid replay).  The caller must either
     *           supply an existing transaction ID or begin a new transaction.
     *     @type \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement[]|\Google\Protobuf\Internal\RepeatedField $statements
     *           The list of statements to execute in this batch. Statements are executed
     *           serially, such that the effects of statement i are visible to statement
     *           i+1. Each statement must be a DML statement. Execution will stop at the
     *           first failed statement; the remaining statements will not run.
     *           REQUIRES: statements_size() > 0.
     *     @type int|string $seqno
     *           A per-transaction sequence number used to identify this request. This is
     *           used in the same space as the seqno in
     *           [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
     *           in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Spanner\V1\Spanner::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The session in which the DML statements should be performed.
     *
     * Generated from protobuf field <code>string session = 1;</code>
     * @return string
     */
    public function getSession()
    {
        return $this->session;
    }

    /**
     * Required. The session in which the DML statements should be performed.
     *
     * Generated from protobuf field <code>string session = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setSession($var)
    {
        GPBUtil::checkString($var, True);
        $this->session = $var;

        return $this;
    }

    /**
     * The transaction to use. A ReadWrite transaction is required. Single-use
     * transactions are not supported (to avoid replay).  The caller must either
     * supply an existing transaction ID or begin a new transaction.
     *
     * Generated from protobuf field <code>.google.spanner.v1.TransactionSelector transaction = 2;</code>
     * @return \Google\Cloud\Spanner\V1\TransactionSelector
     */
    public function getTransaction()
    {
        return $this->transaction;
    }

    /**
     * The transaction to use. A ReadWrite transaction is required. Single-use
     * transactions are not supported (to avoid replay).  The caller must either
     * supply an existing transaction ID or begin a new transaction.
     *
     * Generated from protobuf field <code>.google.spanner.v1.TransactionSelector transaction = 2;</code>
     * @param \Google\Cloud\Spanner\V1\TransactionSelector $var
     * @return $this
     */
    public function setTransaction($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class);
        $this->transaction = $var;

        return $this;
    }

    /**
     * The list of statements to execute in this batch. Statements are executed
     * serially, such that the effects of statement i are visible to statement
     * i+1. Each statement must be a DML statement. Execution will stop at the
     * first failed statement; the remaining statements will not run.
     * REQUIRES: statements_size() > 0.
     *
     * Generated from protobuf field <code>repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getStatements()
    {
        return $this->statements;
    }

    /**
     * The list of statements to execute in this batch. Statements are executed
     * serially, such that the effects of statement i are visible to statement
     * i+1. Each statement must be a DML statement. Execution will stop at the
     * first failed statement; the remaining statements will not run.
     * REQUIRES: statements_size() > 0.
     *
     * Generated from protobuf field <code>repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3;</code>
     * @param \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setStatements($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement::class);
        $this->statements = $arr;

        return $this;
    }

    /**
     * A per-transaction sequence number used to identify this request. This is
     * used in the same space as the seqno in
     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
     *
     * Generated from protobuf field <code>int64 seqno = 4;</code>
     * @return int|string
     */
    public function getSeqno()
    {
        return $this->seqno;
    }

    /**
     * A per-transaction sequence number used to identify this request. This is
     * used in the same space as the seqno in
     * [ExecuteSqlRequest][Spanner.ExecuteSqlRequest]. See more details
     * in [ExecuteSqlRequest][Spanner.ExecuteSqlRequest].
     *
     * Generated from protobuf field <code>int64 seqno = 4;</code>
     * @param int|string $var
     * @return $this
     */
    public function setSeqno($var)
    {
        GPBUtil::checkInt64($var);
        $this->seqno = $var;

        return $this;
    }

}

