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

namespace Google\Cloud\NetworkManagement\V1\ProbingDetails;

use UnexpectedValueException;

/**
 * Overall probing result of the test.
 *
 * Protobuf type <code>google.cloud.networkmanagement.v1.ProbingDetails.ProbingResult</code>
 */
class ProbingResult
{
    /**
     * No result was specified.
     *
     * Generated from protobuf enum <code>PROBING_RESULT_UNSPECIFIED = 0;</code>
     */
    const PROBING_RESULT_UNSPECIFIED = 0;
    /**
     * At least 95% of packets reached the destination.
     *
     * Generated from protobuf enum <code>REACHABLE = 1;</code>
     */
    const REACHABLE = 1;
    /**
     * No packets reached the destination.
     *
     * Generated from protobuf enum <code>UNREACHABLE = 2;</code>
     */
    const UNREACHABLE = 2;
    /**
     * Less than 95% of packets reached the destination.
     *
     * Generated from protobuf enum <code>REACHABILITY_INCONSISTENT = 3;</code>
     */
    const REACHABILITY_INCONSISTENT = 3;
    /**
     * Reachability could not be determined. Possible reasons are:
     * * The user lacks permission to access some of the network resources
     *   required to run the test.
     * * No valid source endpoint could be derived from the request.
     * * An internal error occurred.
     *
     * Generated from protobuf enum <code>UNDETERMINED = 4;</code>
     */
    const UNDETERMINED = 4;

    private static $valueToName = [
        self::PROBING_RESULT_UNSPECIFIED => 'PROBING_RESULT_UNSPECIFIED',
        self::REACHABLE => 'REACHABLE',
        self::UNREACHABLE => 'UNREACHABLE',
        self::REACHABILITY_INCONSISTENT => 'REACHABILITY_INCONSISTENT',
        self::UNDETERMINED => 'UNDETERMINED',
    ];

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


