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

namespace Google\Cloud\ResourceSettings\V1\SettingMetadata;

use UnexpectedValueException;

/**
 * The data type for setting values of this setting. See [Value][google.cloud.resourcesettings.v1.Value] for more
 * details on the available data types.
 *
 * Protobuf type <code>google.cloud.resourcesettings.v1.SettingMetadata.DataType</code>
 */
class DataType
{
    /**
     * Unspecified data type.
     *
     * Generated from protobuf enum <code>DATA_TYPE_UNSPECIFIED = 0;</code>
     */
    const DATA_TYPE_UNSPECIFIED = 0;
    /**
     * A boolean setting.
     *
     * Generated from protobuf enum <code>BOOLEAN = 1;</code>
     */
    const BOOLEAN = 1;
    /**
     * A string setting.
     *
     * Generated from protobuf enum <code>STRING = 2;</code>
     */
    const STRING = 2;
    /**
     * A string set setting.
     *
     * Generated from protobuf enum <code>STRING_SET = 3;</code>
     */
    const STRING_SET = 3;
    /**
     * A Enum setting
     *
     * Generated from protobuf enum <code>ENUM_VALUE = 4;</code>
     */
    const ENUM_VALUE = 4;

    private static $valueToName = [
        self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED',
        self::BOOLEAN => 'BOOLEAN',
        self::STRING => 'STRING',
        self::STRING_SET => 'STRING_SET',
        self::ENUM_VALUE => 'ENUM_VALUE',
    ];

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


