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

namespace Google\Cloud\Speech\V2\StreamingRecognizeResponse;

use UnexpectedValueException;

/**
 * Indicates the type of speech event.
 *
 * Protobuf type <code>google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType</code>
 */
class SpeechEventType
{
    /**
     * No speech event specified.
     *
     * Generated from protobuf enum <code>SPEECH_EVENT_TYPE_UNSPECIFIED = 0;</code>
     */
    const SPEECH_EVENT_TYPE_UNSPECIFIED = 0;
    /**
     * This event indicates that the server has detected the end of the user's
     * speech utterance and expects no additional speech. Therefore, the server
     * will not process additional audio and will close the gRPC bidirectional
     * stream. This event is only sent if there was a force cutoff due to
     * silence being detected early. This event is only available through the
     * `latest_short` [model][google.cloud.speech.v2.Recognizer.model].
     *
     * Generated from protobuf enum <code>END_OF_SINGLE_UTTERANCE = 1;</code>
     */
    const END_OF_SINGLE_UTTERANCE = 1;
    /**
     * This event indicates that the server has detected the beginning of human
     * voice activity in the stream. This event can be returned multiple times
     * if speech starts and stops repeatedly throughout the stream. This event
     * is only sent if `voice_activity_events` is set to true.
     *
     * Generated from protobuf enum <code>SPEECH_ACTIVITY_BEGIN = 2;</code>
     */
    const SPEECH_ACTIVITY_BEGIN = 2;
    /**
     * This event indicates that the server has detected the end of human voice
     * activity in the stream. This event can be returned multiple times if
     * speech starts and stops repeatedly throughout the stream. This event is
     * only sent if `voice_activity_events` is set to true.
     *
     * Generated from protobuf enum <code>SPEECH_ACTIVITY_END = 3;</code>
     */
    const SPEECH_ACTIVITY_END = 3;

    private static $valueToName = [
        self::SPEECH_EVENT_TYPE_UNSPECIFIED => 'SPEECH_EVENT_TYPE_UNSPECIFIED',
        self::END_OF_SINGLE_UTTERANCE => 'END_OF_SINGLE_UTTERANCE',
        self::SPEECH_ACTIVITY_BEGIN => 'SPEECH_ACTIVITY_BEGIN',
        self::SPEECH_ACTIVITY_END => 'SPEECH_ACTIVITY_END',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(SpeechEventType::class, \Google\Cloud\Speech\V2\StreamingRecognizeResponse_SpeechEventType::class);

