<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/spanner/admin/instance/v1/spanner_instance_admin.proto

namespace Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig;

use UnexpectedValueException;

/**
 * The type of this configuration.
 *
 * Protobuf type <code>google.spanner.admin.instance.v1.InstanceConfig.Type</code>
 */
class Type
{
    /**
     * Unspecified.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Google managed configuration.
     *
     * Generated from protobuf enum <code>GOOGLE_MANAGED = 1;</code>
     */
    const GOOGLE_MANAGED = 1;
    /**
     * User managed configuration.
     *
     * Generated from protobuf enum <code>USER_MANAGED = 2;</code>
     */
    const USER_MANAGED = 2;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::GOOGLE_MANAGED => 'GOOGLE_MANAGED',
        self::USER_MANAGED => 'USER_MANAGED',
    ];

    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(Type::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_Type::class);

