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

namespace Google\Cloud\Compute\V1\Route;

use UnexpectedValueException;

/**
 * [Output Only] The type of this route, which can be one of the following values: - 'TRANSIT' for a transit route that this router learned from another Cloud Router and will readvertise to one of its BGP peers - 'SUBNET' for a route from a subnet of the VPC - 'BGP' for a route learned from a BGP peer of this router - 'STATIC' for a static route
 *
 * Protobuf type <code>google.cloud.compute.v1.Route.RouteType</code>
 */
class RouteType
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_ROUTE_TYPE = 0;</code>
     */
    const UNDEFINED_ROUTE_TYPE = 0;
    /**
     * Generated from protobuf enum <code>BGP = 65707;</code>
     */
    const BGP = 65707;
    /**
     * Generated from protobuf enum <code>STATIC = 308331118;</code>
     */
    const PBSTATIC = 308331118;
    /**
     * Generated from protobuf enum <code>SUBNET = 309278557;</code>
     */
    const SUBNET = 309278557;
    /**
     * Generated from protobuf enum <code>TRANSIT = 187793843;</code>
     */
    const TRANSIT = 187793843;

    private static $valueToName = [
        self::UNDEFINED_ROUTE_TYPE => 'UNDEFINED_ROUTE_TYPE',
        self::BGP => 'BGP',
        self::PBSTATIC => 'STATIC',
        self::SUBNET => 'SUBNET',
        self::TRANSIT => 'TRANSIT',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}


