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

namespace Google\Cloud\Dialogflow\V2\Tool\Authentication\OAuthConfig;

use UnexpectedValueException;

/**
 * OAuth grant types. Only [client credential
 * grant](https://oauth.net/2/grant-types/client-credentials) is
 * supported.
 *
 * Protobuf type <code>google.cloud.dialogflow.v2.Tool.Authentication.OAuthConfig.OauthGrantType</code>
 */
class OauthGrantType
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>OAUTH_GRANT_TYPE_UNSPECIFIED = 0;</code>
     */
    const OAUTH_GRANT_TYPE_UNSPECIFIED = 0;
    /**
     * Represents the [client credential
     * flow](https://oauth.net/2/grant-types/client-credentials).
     *
     * Generated from protobuf enum <code>CLIENT_CREDENTIAL = 1;</code>
     */
    const CLIENT_CREDENTIAL = 1;

    private static $valueToName = [
        self::OAUTH_GRANT_TYPE_UNSPECIFIED => 'OAUTH_GRANT_TYPE_UNSPECIFIED',
        self::CLIENT_CREDENTIAL => 'CLIENT_CREDENTIAL',
    ];

    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);
    }
}


