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

namespace Google\Cloud\ApiHub\V1;

use UnexpectedValueException;

/**
 * AuthType represents the authentication type.
 *
 * Protobuf type <code>google.cloud.apihub.v1.AuthType</code>
 */
class AuthType
{
    /**
     * Authentication type not specified.
     *
     * Generated from protobuf enum <code>AUTH_TYPE_UNSPECIFIED = 0;</code>
     */
    const AUTH_TYPE_UNSPECIFIED = 0;
    /**
     * No authentication.
     *
     * Generated from protobuf enum <code>NO_AUTH = 1;</code>
     */
    const NO_AUTH = 1;
    /**
     * Google service account authentication.
     *
     * Generated from protobuf enum <code>GOOGLE_SERVICE_ACCOUNT = 2;</code>
     */
    const GOOGLE_SERVICE_ACCOUNT = 2;
    /**
     * Username and password authentication.
     *
     * Generated from protobuf enum <code>USER_PASSWORD = 3;</code>
     */
    const USER_PASSWORD = 3;
    /**
     * API Key authentication.
     *
     * Generated from protobuf enum <code>API_KEY = 4;</code>
     */
    const API_KEY = 4;
    /**
     * Oauth 2.0 client credentials grant authentication.
     *
     * Generated from protobuf enum <code>OAUTH2_CLIENT_CREDENTIALS = 5;</code>
     */
    const OAUTH2_CLIENT_CREDENTIALS = 5;

    private static $valueToName = [
        self::AUTH_TYPE_UNSPECIFIED => 'AUTH_TYPE_UNSPECIFIED',
        self::NO_AUTH => 'NO_AUTH',
        self::GOOGLE_SERVICE_ACCOUNT => 'GOOGLE_SERVICE_ACCOUNT',
        self::USER_PASSWORD => 'USER_PASSWORD',
        self::API_KEY => 'API_KEY',
        self::OAUTH2_CLIENT_CREDENTIALS => 'OAUTH2_CLIENT_CREDENTIALS',
    ];

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

