<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: couchbase/kv/v1/kv.proto

namespace Couchbase\Protostellar\Generated\KV\V1;

use UnexpectedValueException;

/**
 * Protobuf type <code>couchbase.kv.v1.CompressionEnabled</code>
 */
class CompressionEnabled
{
    /**
     * Generated from protobuf enum <code>COMPRESSION_ENABLED_OPTIONAL = 0;</code>
     */
    const COMPRESSION_ENABLED_OPTIONAL = 0;
    /**
     * Generated from protobuf enum <code>COMPRESSION_ENABLED_ALWAYS = 1;</code>
     */
    const COMPRESSION_ENABLED_ALWAYS = 1;

    private static $valueToName = [
        self::COMPRESSION_ENABLED_OPTIONAL => 'COMPRESSION_ENABLED_OPTIONAL',
        self::COMPRESSION_ENABLED_ALWAYS => 'COMPRESSION_ENABLED_ALWAYS',
    ];

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

