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

namespace Google\Cloud\Speech\V1\RecognitionMetadata;

use UnexpectedValueException;

/**
 * Enumerates the types of capture settings describing an audio file.
 *
 * Protobuf type <code>google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance</code>
 */
class MicrophoneDistance
{
    /**
     * Audio type is not known.
     *
     * Generated from protobuf enum <code>MICROPHONE_DISTANCE_UNSPECIFIED = 0;</code>
     */
    const MICROPHONE_DISTANCE_UNSPECIFIED = 0;
    /**
     * The audio was captured from a closely placed microphone. Eg. phone,
     * dictaphone, or handheld microphone. Generally if there speaker is within
     * 1 meter of the microphone.
     *
     * Generated from protobuf enum <code>NEARFIELD = 1;</code>
     */
    const NEARFIELD = 1;
    /**
     * The speaker if within 3 meters of the microphone.
     *
     * Generated from protobuf enum <code>MIDFIELD = 2;</code>
     */
    const MIDFIELD = 2;
    /**
     * The speaker is more than 3 meters away from the microphone.
     *
     * Generated from protobuf enum <code>FARFIELD = 3;</code>
     */
    const FARFIELD = 3;

    private static $valueToName = [
        self::MICROPHONE_DISTANCE_UNSPECIFIED => 'MICROPHONE_DISTANCE_UNSPECIFIED',
        self::NEARFIELD => 'NEARFIELD',
        self::MIDFIELD => 'MIDFIELD',
        self::FARFIELD => 'FARFIELD',
    ];

    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(MicrophoneDistance::class, \Google\Cloud\Speech\V1\RecognitionMetadata_MicrophoneDistance::class);

