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

namespace Google\Cloud\AlloyDb\V1\InjectFaultRequest;

use UnexpectedValueException;

/**
 * FaultType contains all valid types of faults that can be injected to an
 * instance.
 *
 * Protobuf type <code>google.cloud.alloydb.v1.InjectFaultRequest.FaultType</code>
 */
class FaultType
{
    /**
     * The fault type is unknown.
     *
     * Generated from protobuf enum <code>FAULT_TYPE_UNSPECIFIED = 0;</code>
     */
    const FAULT_TYPE_UNSPECIFIED = 0;
    /**
     * Stop the VM
     *
     * Generated from protobuf enum <code>STOP_VM = 1;</code>
     */
    const STOP_VM = 1;

    private static $valueToName = [
        self::FAULT_TYPE_UNSPECIFIED => 'FAULT_TYPE_UNSPECIFIED',
        self::STOP_VM => 'STOP_VM',
    ];

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

