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

namespace Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService;

use UnexpectedValueException;

/**
 * Indicate the auth token type generated from the [Diglogflow service
 * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent).
 *
 * Protobuf type <code>google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAgentAuth</code>
 */
class ServiceAgentAuth
{
    /**
     * Service agent auth type unspecified. Default to ID_TOKEN.
     *
     * Generated from protobuf enum <code>SERVICE_AGENT_AUTH_UNSPECIFIED = 0;</code>
     */
    const SERVICE_AGENT_AUTH_UNSPECIFIED = 0;
    /**
     * No token used.
     *
     * Generated from protobuf enum <code>NONE = 1;</code>
     */
    const NONE = 1;
    /**
     * Use [ID
     * token](https://cloud.google.com/docs/authentication/token-types#id)
     * generated from service agent. This can be used to access Cloud Function
     * and Cloud Run after you grant Invoker role to
     * `service-<PROJECT-NUMBER>&#64;gcp-sa-dialogflow.iam.gserviceaccount.com`.
     *
     * Generated from protobuf enum <code>ID_TOKEN = 2;</code>
     */
    const ID_TOKEN = 2;
    /**
     * Use [access
     * token](https://cloud.google.com/docs/authentication/token-types#access)
     * generated from service agent. This can be used to access other Google
     * Cloud APIs after you grant required roles to
     * `service-<PROJECT-NUMBER>&#64;gcp-sa-dialogflow.iam.gserviceaccount.com`.
     *
     * Generated from protobuf enum <code>ACCESS_TOKEN = 3;</code>
     */
    const ACCESS_TOKEN = 3;

    private static $valueToName = [
        self::SERVICE_AGENT_AUTH_UNSPECIFIED => 'SERVICE_AGENT_AUTH_UNSPECIFIED',
        self::NONE => 'NONE',
        self::ID_TOKEN => 'ID_TOKEN',
        self::ACCESS_TOKEN => 'ACCESS_TOKEN',
    ];

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


