<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/sql/v1beta4/cloud_sql_users.proto

namespace Google\Cloud\Sql\V1beta4\User;

use UnexpectedValueException;

/**
 * The user type.
 *
 * Protobuf type <code>google.cloud.sql.v1beta4.User.SqlUserType</code>
 */
class SqlUserType
{
    /**
     * The database's built-in user type.
     *
     * Generated from protobuf enum <code>BUILT_IN = 0;</code>
     */
    const BUILT_IN = 0;
    /**
     * Cloud IAM user.
     *
     * Generated from protobuf enum <code>CLOUD_IAM_USER = 1;</code>
     */
    const CLOUD_IAM_USER = 1;
    /**
     * Cloud IAM service account.
     *
     * Generated from protobuf enum <code>CLOUD_IAM_SERVICE_ACCOUNT = 2;</code>
     */
    const CLOUD_IAM_SERVICE_ACCOUNT = 2;

    private static $valueToName = [
        self::BUILT_IN => 'BUILT_IN',
        self::CLOUD_IAM_USER => 'CLOUD_IAM_USER',
        self::CLOUD_IAM_SERVICE_ACCOUNT => 'CLOUD_IAM_SERVICE_ACCOUNT',
    ];

    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(SqlUserType::class, \Google\Cloud\Sql\V1beta4\User_SqlUserType::class);

