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

namespace Google\Cloud\GkeMultiCloud\V1\Toleration;

use UnexpectedValueException;

/**
 * KeyOperator represents a key's relationship to the value e.g. 'Equal'.
 *
 * Protobuf type <code>google.cloud.gkemulticloud.v1.Toleration.KeyOperator</code>
 */
class KeyOperator
{
    /**
     * Operator is not specified.
     *
     * Generated from protobuf enum <code>KEY_OPERATOR_UNSPECIFIED = 0;</code>
     */
    const KEY_OPERATOR_UNSPECIFIED = 0;
    /**
     * Operator maps to 'Equal'.
     *
     * Generated from protobuf enum <code>KEY_OPERATOR_EQUAL = 1;</code>
     */
    const KEY_OPERATOR_EQUAL = 1;
    /**
     * Operator maps to 'Exists'.
     *
     * Generated from protobuf enum <code>KEY_OPERATOR_EXISTS = 2;</code>
     */
    const KEY_OPERATOR_EXISTS = 2;

    private static $valueToName = [
        self::KEY_OPERATOR_UNSPECIFIED => 'KEY_OPERATOR_UNSPECIFIED',
        self::KEY_OPERATOR_EQUAL => 'KEY_OPERATOR_EQUAL',
        self::KEY_OPERATOR_EXISTS => 'KEY_OPERATOR_EXISTS',
    ];

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

