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

namespace Google\Cloud\Chronicle\V1\RuleDeployment;

use UnexpectedValueException;

/**
 * The possible execution states the rule deployment can be in.
 *
 * Protobuf type <code>google.cloud.chronicle.v1.RuleDeployment.ExecutionState</code>
 */
class ExecutionState
{
    /**
     * Unspecified or unknown execution state.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_UNSPECIFIED = 0;</code>
     */
    const EXECUTION_STATE_UNSPECIFIED = 0;
    /**
     * Default execution state.
     *
     * Generated from protobuf enum <code>DEFAULT = 1;</code>
     */
    const PBDEFAULT = 1;
    /**
     * Rules in limited state may not have their executions guaranteed.
     *
     * Generated from protobuf enum <code>LIMITED = 2;</code>
     */
    const LIMITED = 2;
    /**
     * Paused rules are not executed at all.
     *
     * Generated from protobuf enum <code>PAUSED = 3;</code>
     */
    const PAUSED = 3;

    private static $valueToName = [
        self::EXECUTION_STATE_UNSPECIFIED => 'EXECUTION_STATE_UNSPECIFIED',
        self::PBDEFAULT => 'DEFAULT',
        self::LIMITED => 'LIMITED',
        self::PAUSED => 'PAUSED',
    ];

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


