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

namespace Google\Cloud\Speech\V2;

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

/**
 * Available recognition features specific to streaming recognition requests.
 *
 * Generated from protobuf message <code>google.cloud.speech.v2.StreamingRecognitionFeatures</code>
 */
class StreamingRecognitionFeatures extends \Google\Protobuf\Internal\Message
{
    /**
     * If `true`, responses with voice activity speech events will be returned as
     * they are detected.
     *
     * Generated from protobuf field <code>bool enable_voice_activity_events = 1;</code>
     */
    private $enable_voice_activity_events = false;
    /**
     * Whether or not to stream interim results to the client. If set to true,
     * interim results will be streamed to the client. Otherwise, only the final
     * response will be streamed back.
     *
     * Generated from protobuf field <code>bool interim_results = 2;</code>
     */
    private $interim_results = false;
    /**
     * If set, the server will automatically close the stream after the specified
     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
     * sent. The field `voice_activity_events` must also be set to true.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3;</code>
     */
    private $voice_activity_timeout = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $enable_voice_activity_events
     *           If `true`, responses with voice activity speech events will be returned as
     *           they are detected.
     *     @type bool $interim_results
     *           Whether or not to stream interim results to the client. If set to true,
     *           interim results will be streamed to the client. Otherwise, only the final
     *           response will be streamed back.
     *     @type \Google\Cloud\Speech\V2\StreamingRecognitionFeatures\VoiceActivityTimeout $voice_activity_timeout
     *           If set, the server will automatically close the stream after the specified
     *           duration has elapsed after the last VOICE_ACTIVITY speech event has been
     *           sent. The field `voice_activity_events` must also be set to true.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Speech\V2\CloudSpeech::initOnce();
        parent::__construct($data);
    }

    /**
     * If `true`, responses with voice activity speech events will be returned as
     * they are detected.
     *
     * Generated from protobuf field <code>bool enable_voice_activity_events = 1;</code>
     * @return bool
     */
    public function getEnableVoiceActivityEvents()
    {
        return $this->enable_voice_activity_events;
    }

    /**
     * If `true`, responses with voice activity speech events will be returned as
     * they are detected.
     *
     * Generated from protobuf field <code>bool enable_voice_activity_events = 1;</code>
     * @param bool $var
     * @return $this
     */
    public function setEnableVoiceActivityEvents($var)
    {
        GPBUtil::checkBool($var);
        $this->enable_voice_activity_events = $var;

        return $this;
    }

    /**
     * Whether or not to stream interim results to the client. If set to true,
     * interim results will be streamed to the client. Otherwise, only the final
     * response will be streamed back.
     *
     * Generated from protobuf field <code>bool interim_results = 2;</code>
     * @return bool
     */
    public function getInterimResults()
    {
        return $this->interim_results;
    }

    /**
     * Whether or not to stream interim results to the client. If set to true,
     * interim results will be streamed to the client. Otherwise, only the final
     * response will be streamed back.
     *
     * Generated from protobuf field <code>bool interim_results = 2;</code>
     * @param bool $var
     * @return $this
     */
    public function setInterimResults($var)
    {
        GPBUtil::checkBool($var);
        $this->interim_results = $var;

        return $this;
    }

    /**
     * If set, the server will automatically close the stream after the specified
     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
     * sent. The field `voice_activity_events` must also be set to true.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3;</code>
     * @return \Google\Cloud\Speech\V2\StreamingRecognitionFeatures\VoiceActivityTimeout|null
     */
    public function getVoiceActivityTimeout()
    {
        return $this->voice_activity_timeout;
    }

    public function hasVoiceActivityTimeout()
    {
        return isset($this->voice_activity_timeout);
    }

    public function clearVoiceActivityTimeout()
    {
        unset($this->voice_activity_timeout);
    }

    /**
     * If set, the server will automatically close the stream after the specified
     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
     * sent. The field `voice_activity_events` must also be set to true.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3;</code>
     * @param \Google\Cloud\Speech\V2\StreamingRecognitionFeatures\VoiceActivityTimeout $var
     * @return $this
     */
    public function setVoiceActivityTimeout($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\StreamingRecognitionFeatures\VoiceActivityTimeout::class);
        $this->voice_activity_timeout = $var;

        return $this;
    }

}

