<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/databasecenter/v1beta/service.proto

namespace Google\Cloud\DatabaseCenter\V1beta;

use UnexpectedValueException;

/**
 * SubResourceType refers to the sub-type of database resource.
 *
 * Protobuf type <code>google.cloud.databasecenter.v1beta.SubResourceType</code>
 */
class SubResourceType
{
    /**
     * Unspecified.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_UNSPECIFIED = 0;</code>
     */
    const SUB_RESOURCE_TYPE_UNSPECIFIED = 0;
    /**
     * A resource acting as a primary.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_PRIMARY = 1;</code>
     */
    const SUB_RESOURCE_TYPE_PRIMARY = 1;
    /**
     * A resource acting as a secondary.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_SECONDARY = 2;</code>
     */
    const SUB_RESOURCE_TYPE_SECONDARY = 2;
    /**
     * A resource acting as a read-replica.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_READ_REPLICA = 3;</code>
     */
    const SUB_RESOURCE_TYPE_READ_REPLICA = 3;
    /**
     * A resource acting as an external primary.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_EXTERNAL_PRIMARY = 5;</code>
     */
    const SUB_RESOURCE_TYPE_EXTERNAL_PRIMARY = 5;
    /**
     * A resource acting as a read pool.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_READ_POOL = 6;</code>
     */
    const SUB_RESOURCE_TYPE_READ_POOL = 6;
    /**
     * Represents a reservation resource.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_RESERVATION = 7;</code>
     */
    const SUB_RESOURCE_TYPE_RESERVATION = 7;
    /**
     * Represents a dataset resource.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_DATASET = 8;</code>
     */
    const SUB_RESOURCE_TYPE_DATASET = 8;
    /**
     * For the rest of the categories.
     *
     * Generated from protobuf enum <code>SUB_RESOURCE_TYPE_OTHER = 4;</code>
     */
    const SUB_RESOURCE_TYPE_OTHER = 4;

    private static $valueToName = [
        self::SUB_RESOURCE_TYPE_UNSPECIFIED => 'SUB_RESOURCE_TYPE_UNSPECIFIED',
        self::SUB_RESOURCE_TYPE_PRIMARY => 'SUB_RESOURCE_TYPE_PRIMARY',
        self::SUB_RESOURCE_TYPE_SECONDARY => 'SUB_RESOURCE_TYPE_SECONDARY',
        self::SUB_RESOURCE_TYPE_READ_REPLICA => 'SUB_RESOURCE_TYPE_READ_REPLICA',
        self::SUB_RESOURCE_TYPE_EXTERNAL_PRIMARY => 'SUB_RESOURCE_TYPE_EXTERNAL_PRIMARY',
        self::SUB_RESOURCE_TYPE_READ_POOL => 'SUB_RESOURCE_TYPE_READ_POOL',
        self::SUB_RESOURCE_TYPE_RESERVATION => 'SUB_RESOURCE_TYPE_RESERVATION',
        self::SUB_RESOURCE_TYPE_DATASET => 'SUB_RESOURCE_TYPE_DATASET',
        self::SUB_RESOURCE_TYPE_OTHER => 'SUB_RESOURCE_TYPE_OTHER',
    ];

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

