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

namespace Couchbase\Protostellar\Generated\KV\V1\MutateInRequest;

use UnexpectedValueException;

/**
 * Protobuf type <code>couchbase.kv.v1.MutateInRequest.StoreSemantic</code>
 */
class StoreSemantic
{
    /**
     * Generated from protobuf enum <code>STORE_SEMANTIC_REPLACE = 0;</code>
     */
    const STORE_SEMANTIC_REPLACE = 0;
    /**
     * Generated from protobuf enum <code>STORE_SEMANTIC_UPSERT = 1;</code>
     */
    const STORE_SEMANTIC_UPSERT = 1;
    /**
     * Generated from protobuf enum <code>STORE_SEMANTIC_INSERT = 2;</code>
     */
    const STORE_SEMANTIC_INSERT = 2;

    private static $valueToName = [
        self::STORE_SEMANTIC_REPLACE => 'STORE_SEMANTIC_REPLACE',
        self::STORE_SEMANTIC_UPSERT => 'STORE_SEMANTIC_UPSERT',
        self::STORE_SEMANTIC_INSERT => 'STORE_SEMANTIC_INSERT',
    ];

    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(StoreSemantic::class, \Couchbase\Protostellar\Generated\KV\V1\MutateInRequest_StoreSemantic::class);

