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

namespace Google\Cloud\Compute\V1\PacketIntervals;

use UnexpectedValueException;

/**
 * The type of packets for which inter-packet intervals were computed.
 *
 * Protobuf type <code>google.cloud.compute.v1.PacketIntervals.Type</code>
 */
class Type
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_TYPE = 0;</code>
     */
    const UNDEFINED_TYPE = 0;
    /**
     * Only applies to Echo packets. This shows the intervals between sending and receiving the same packet.
     *
     * Generated from protobuf enum <code>LOOPBACK = 356174219;</code>
     */
    const LOOPBACK = 356174219;
    /**
     * Intervals between received packets.
     *
     * Generated from protobuf enum <code>RECEIVE = 189660867;</code>
     */
    const RECEIVE = 189660867;
    /**
     * Intervals between transmitted packets.
     *
     * Generated from protobuf enum <code>TRANSMIT = 452903600;</code>
     */
    const TRANSMIT = 452903600;
    /**
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 437714322;</code>
     */
    const TYPE_UNSPECIFIED = 437714322;

    private static $valueToName = [
        self::UNDEFINED_TYPE => 'UNDEFINED_TYPE',
        self::LOOPBACK => 'LOOPBACK',
        self::RECEIVE => 'RECEIVE',
        self::TRANSMIT => 'TRANSMIT',
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
    ];

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


