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

namespace Google\Cloud\ApiHub\V1\PluginInstanceAction;

use UnexpectedValueException;

/**
 * State represents the state of the plugin instance action.
 *
 * Protobuf type <code>google.cloud.apihub.v1.PluginInstanceAction.State</code>
 */
class State
{
    /**
     * Default unspecified state.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The action is enabled in the plugin instance i.e., executions can
     * be triggered for this action.
     *
     * Generated from protobuf enum <code>ENABLED = 1;</code>
     */
    const ENABLED = 1;
    /**
     * The action is disabled in the plugin instance i.e., no executions
     * can be triggered for this action. This state indicates that the user
     * explicitly disabled the instance, and no further action is needed unless
     * the user wants to re-enable it.
     *
     * Generated from protobuf enum <code>DISABLED = 2;</code>
     */
    const DISABLED = 2;
    /**
     * The action in the plugin instance is being enabled.
     *
     * Generated from protobuf enum <code>ENABLING = 3;</code>
     */
    const ENABLING = 3;
    /**
     * The action in the plugin instance is being disabled.
     *
     * Generated from protobuf enum <code>DISABLING = 4;</code>
     */
    const DISABLING = 4;
    /**
     * The ERROR state can come while enabling/disabling plugin instance action.
     * Users can retrigger enable, disable via
     * [EnablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]
     * and
     * [DisablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]
     * to restore the action back to enabled/disabled state. Note enable/disable
     * on actions can only be triggered if plugin instance is in Active state.
     *
     * Generated from protobuf enum <code>ERROR = 5;</code>
     */
    const ERROR = 5;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::ENABLED => 'ENABLED',
        self::DISABLED => 'DISABLED',
        self::ENABLING => 'ENABLING',
        self::DISABLING => 'DISABLING',
        self::ERROR => 'ERROR',
    ];

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

