<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: WAProto.proto

namespace PhpWA\Protocol\Proto;

use UnexpectedValueException;

/**
 * Protobuf type <code>proto.CollectionName</code>
 */
class CollectionName
{
    /**
     * Generated from protobuf enum <code>COLLECTION_NAME_UNKNOWN = 0;</code>
     */
    const COLLECTION_NAME_UNKNOWN = 0;
    /**
     * Generated from protobuf enum <code>REGULAR = 1;</code>
     */
    const REGULAR = 1;
    /**
     * Generated from protobuf enum <code>REGULAR_LOW = 2;</code>
     */
    const REGULAR_LOW = 2;
    /**
     * Generated from protobuf enum <code>REGULAR_HIGH = 3;</code>
     */
    const REGULAR_HIGH = 3;
    /**
     * Generated from protobuf enum <code>CRITICAL_BLOCK = 4;</code>
     */
    const CRITICAL_BLOCK = 4;
    /**
     * Generated from protobuf enum <code>CRITICAL_UNBLOCK_LOW = 5;</code>
     */
    const CRITICAL_UNBLOCK_LOW = 5;

    private static $valueToName = [
        self::COLLECTION_NAME_UNKNOWN => 'COLLECTION_NAME_UNKNOWN',
        self::REGULAR => 'REGULAR',
        self::REGULAR_LOW => 'REGULAR_LOW',
        self::REGULAR_HIGH => 'REGULAR_HIGH',
        self::CRITICAL_BLOCK => 'CRITICAL_BLOCK',
        self::CRITICAL_UNBLOCK_LOW => 'CRITICAL_UNBLOCK_LOW',
    ];

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

