<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/logging/v2/logging_config.proto

namespace Google\Cloud\Logging\V2;

use UnexpectedValueException;

/**
 * IndexType is used for custom indexing. It describes the type of an indexed
 * field.
 *
 * Protobuf type <code>google.logging.v2.IndexType</code>
 */
class IndexType
{
    /**
     * The index's type is unspecified.
     *
     * Generated from protobuf enum <code>INDEX_TYPE_UNSPECIFIED = 0;</code>
     */
    const INDEX_TYPE_UNSPECIFIED = 0;
    /**
     * The index is a string-type index.
     *
     * Generated from protobuf enum <code>INDEX_TYPE_STRING = 1;</code>
     */
    const INDEX_TYPE_STRING = 1;
    /**
     * The index is a integer-type index.
     *
     * Generated from protobuf enum <code>INDEX_TYPE_INTEGER = 2;</code>
     */
    const INDEX_TYPE_INTEGER = 2;

    private static $valueToName = [
        self::INDEX_TYPE_UNSPECIFIED => 'INDEX_TYPE_UNSPECIFIED',
        self::INDEX_TYPE_STRING => 'INDEX_TYPE_STRING',
        self::INDEX_TYPE_INTEGER => 'INDEX_TYPE_INTEGER',
    ];

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

