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

namespace Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag;

use UnexpectedValueException;

/**
 * The scope of the flag.
 *
 * Protobuf type <code>google.cloud.alloydb.v1.SupportedDatabaseFlag.Scope</code>
 */
class Scope
{
    /**
     * The scope of the flag is not specified. Default is DATABASE.
     *
     * Generated from protobuf enum <code>SCOPE_UNSPECIFIED = 0;</code>
     */
    const SCOPE_UNSPECIFIED = 0;
    /**
     * The flag is a database flag.
     *
     * Generated from protobuf enum <code>DATABASE = 1;</code>
     */
    const DATABASE = 1;
    /**
     * The flag is a connection pool flag.
     *
     * Generated from protobuf enum <code>CONNECTION_POOL = 2;</code>
     */
    const CONNECTION_POOL = 2;

    private static $valueToName = [
        self::SCOPE_UNSPECIFIED => 'SCOPE_UNSPECIFIED',
        self::DATABASE => 'DATABASE',
        self::CONNECTION_POOL => 'CONNECTION_POOL',
    ];

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

