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

namespace Google\Cloud\AlloyDb\V1\Cluster;

use UnexpectedValueException;

/**
 * Type of Cluster
 *
 * Protobuf type <code>google.cloud.alloydb.v1.Cluster.ClusterType</code>
 */
class ClusterType
{
    /**
     * The type of the cluster is unknown.
     *
     * Generated from protobuf enum <code>CLUSTER_TYPE_UNSPECIFIED = 0;</code>
     */
    const CLUSTER_TYPE_UNSPECIFIED = 0;
    /**
     * Primary cluster that support read and write operations.
     *
     * Generated from protobuf enum <code>PRIMARY = 1;</code>
     */
    const PRIMARY = 1;
    /**
     * Secondary cluster that is replicating from another region.
     * This only supports read.
     *
     * Generated from protobuf enum <code>SECONDARY = 2;</code>
     */
    const SECONDARY = 2;

    private static $valueToName = [
        self::CLUSTER_TYPE_UNSPECIFIED => 'CLUSTER_TYPE_UNSPECIFIED',
        self::PRIMARY => 'PRIMARY',
        self::SECONDARY => 'SECONDARY',
    ];

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

