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

namespace Google\Cloud\Bigtable\V2;

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

/**
 * Internal usage only.
 *
 * Generated from protobuf message <code>google.bigtable.v2.SessionResponse</code>
 */
class SessionResponse extends \Google\Protobuf\Internal\Message
{
    protected $payload;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Bigtable\V2\OpenSessionResponse $open_session
     *     @type \Google\Cloud\Bigtable\V2\VirtualRpcResponse $virtual_rpc
     *           A vRPC can result in either a successful result or an error.
     *           Error results are separate to allow for multiple vRPC responses,
     *           e.g. for streaming calls like scans (post-V1). See Flow Control.
     *     @type \Google\Cloud\Bigtable\V2\ErrorResponse $error
     *     @type \Google\Cloud\Bigtable\V2\SessionParametersResponse $session_parameters
     *     @type \Google\Cloud\Bigtable\V2\HeartbeatResponse $heartbeat
     *     @type \Google\Cloud\Bigtable\V2\GoAwayResponse $go_away
     *     @type \Google\Cloud\Bigtable\V2\SessionRefreshConfig $session_refresh_config
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\V2\Session::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.OpenSessionResponse open_session = 1;</code>
     * @return \Google\Cloud\Bigtable\V2\OpenSessionResponse|null
     */
    public function getOpenSession()
    {
        return $this->readOneof(1);
    }

    public function hasOpenSession()
    {
        return $this->hasOneof(1);
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.OpenSessionResponse open_session = 1;</code>
     * @param \Google\Cloud\Bigtable\V2\OpenSessionResponse $var
     * @return $this
     */
    public function setOpenSession($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\OpenSessionResponse::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A vRPC can result in either a successful result or an error.
     * Error results are separate to allow for multiple vRPC responses,
     * e.g. for streaming calls like scans (post-V1). See Flow Control.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.VirtualRpcResponse virtual_rpc = 2;</code>
     * @return \Google\Cloud\Bigtable\V2\VirtualRpcResponse|null
     */
    public function getVirtualRpc()
    {
        return $this->readOneof(2);
    }

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

    /**
     * A vRPC can result in either a successful result or an error.
     * Error results are separate to allow for multiple vRPC responses,
     * e.g. for streaming calls like scans (post-V1). See Flow Control.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.VirtualRpcResponse virtual_rpc = 2;</code>
     * @param \Google\Cloud\Bigtable\V2\VirtualRpcResponse $var
     * @return $this
     */
    public function setVirtualRpc($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\VirtualRpcResponse::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.ErrorResponse error = 3;</code>
     * @return \Google\Cloud\Bigtable\V2\ErrorResponse|null
     */
    public function getError()
    {
        return $this->readOneof(3);
    }

    public function hasError()
    {
        return $this->hasOneof(3);
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.ErrorResponse error = 3;</code>
     * @param \Google\Cloud\Bigtable\V2\ErrorResponse $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ErrorResponse::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.SessionParametersResponse session_parameters = 4;</code>
     * @return \Google\Cloud\Bigtable\V2\SessionParametersResponse|null
     */
    public function getSessionParameters()
    {
        return $this->readOneof(4);
    }

    public function hasSessionParameters()
    {
        return $this->hasOneof(4);
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.SessionParametersResponse session_parameters = 4;</code>
     * @param \Google\Cloud\Bigtable\V2\SessionParametersResponse $var
     * @return $this
     */
    public function setSessionParameters($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\SessionParametersResponse::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.HeartbeatResponse heartbeat = 5;</code>
     * @return \Google\Cloud\Bigtable\V2\HeartbeatResponse|null
     */
    public function getHeartbeat()
    {
        return $this->readOneof(5);
    }

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

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.HeartbeatResponse heartbeat = 5;</code>
     * @param \Google\Cloud\Bigtable\V2\HeartbeatResponse $var
     * @return $this
     */
    public function setHeartbeat($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\HeartbeatResponse::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.GoAwayResponse go_away = 6;</code>
     * @return \Google\Cloud\Bigtable\V2\GoAwayResponse|null
     */
    public function getGoAway()
    {
        return $this->readOneof(6);
    }

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

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.GoAwayResponse go_away = 6;</code>
     * @param \Google\Cloud\Bigtable\V2\GoAwayResponse $var
     * @return $this
     */
    public function setGoAway($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\GoAwayResponse::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.SessionRefreshConfig session_refresh_config = 7;</code>
     * @return \Google\Cloud\Bigtable\V2\SessionRefreshConfig|null
     */
    public function getSessionRefreshConfig()
    {
        return $this->readOneof(7);
    }

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

    /**
     * Generated from protobuf field <code>.google.bigtable.v2.SessionRefreshConfig session_refresh_config = 7;</code>
     * @param \Google\Cloud\Bigtable\V2\SessionRefreshConfig $var
     * @return $this
     */
    public function setSessionRefreshConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\SessionRefreshConfig::class);
        $this->writeOneof(7, $var);

        return $this;
    }

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

}

