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

namespace Google\Cloud\DataCatalog\V1\FieldType;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.datacatalog.v1.FieldType.PrimitiveType</code>
 */
class PrimitiveType
{
    /**
     * This is the default invalid value for a type.
     *
     * Generated from protobuf enum <code>PRIMITIVE_TYPE_UNSPECIFIED = 0;</code>
     */
    const PRIMITIVE_TYPE_UNSPECIFIED = 0;
    /**
     * A double precision number.
     *
     * Generated from protobuf enum <code>DOUBLE = 1;</code>
     */
    const DOUBLE = 1;
    /**
     * An UTF-8 string.
     *
     * Generated from protobuf enum <code>STRING = 2;</code>
     */
    const STRING = 2;
    /**
     * A boolean value.
     *
     * Generated from protobuf enum <code>BOOL = 3;</code>
     */
    const BOOL = 3;
    /**
     * A timestamp.
     *
     * Generated from protobuf enum <code>TIMESTAMP = 4;</code>
     */
    const TIMESTAMP = 4;

    private static $valueToName = [
        self::PRIMITIVE_TYPE_UNSPECIFIED => 'PRIMITIVE_TYPE_UNSPECIFIED',
        self::DOUBLE => 'DOUBLE',
        self::STRING => 'STRING',
        self::BOOL => 'BOOL',
        self::TIMESTAMP => 'TIMESTAMP',
    ];

    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(PrimitiveType::class, \Google\Cloud\DataCatalog\V1\FieldType_PrimitiveType::class);

