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

namespace Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch;

use UnexpectedValueException;

/**
 * The type of the match.
 *
 * Protobuf type <code>google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type</code>
 */
class Type
{
    /**
     * Unspecified.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Will only match the exact name provided.
     *
     * Generated from protobuf enum <code>EXACT = 1;</code>
     */
    const EXACT = 1;
    /**
     * Will interpret grpc_method and grpc_service as regexes. RE2 syntax is
     * supported.
     *
     * Generated from protobuf enum <code>REGULAR_EXPRESSION = 2;</code>
     */
    const REGULAR_EXPRESSION = 2;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::EXACT => 'EXACT',
        self::REGULAR_EXPRESSION => 'REGULAR_EXPRESSION',
    ];

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


