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

namespace Google\Cloud\ApiHub\V1\Attribute;

use UnexpectedValueException;

/**
 * Enumeration of attribute's data type.
 *
 * Protobuf type <code>google.cloud.apihub.v1.Attribute.DataType</code>
 */
class DataType
{
    /**
     * Attribute data type unspecified.
     *
     * Generated from protobuf enum <code>DATA_TYPE_UNSPECIFIED = 0;</code>
     */
    const DATA_TYPE_UNSPECIFIED = 0;
    /**
     * Attribute's value is of type enum.
     *
     * Generated from protobuf enum <code>ENUM = 1;</code>
     */
    const ENUM = 1;
    /**
     * Attribute's value is of type json.
     *
     * Generated from protobuf enum <code>JSON = 2;</code>
     */
    const JSON = 2;
    /**
     * Attribute's value is of type string.
     *
     * Generated from protobuf enum <code>STRING = 3;</code>
     */
    const STRING = 3;

    private static $valueToName = [
        self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED',
        self::ENUM => 'ENUM',
        self::JSON => 'JSON',
        self::STRING => 'STRING',
    ];

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


