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

namespace Google\Cloud\Config\V1\Revision;

use UnexpectedValueException;

/**
 * Actions that generate a revision.
 *
 * Protobuf type <code>google.cloud.config.v1.Revision.Action</code>
 */
class Action
{
    /**
     * The default value. This value is used if the action is omitted.
     *
     * Generated from protobuf enum <code>ACTION_UNSPECIFIED = 0;</code>
     */
    const ACTION_UNSPECIFIED = 0;
    /**
     * The revision was generated by creating a deployment.
     *
     * Generated from protobuf enum <code>CREATE = 1;</code>
     */
    const CREATE = 1;
    /**
     * The revision was generated by updating a deployment.
     *
     * Generated from protobuf enum <code>UPDATE = 2;</code>
     */
    const UPDATE = 2;
    /**
     * The revision was deleted.
     *
     * Generated from protobuf enum <code>DELETE = 3;</code>
     */
    const DELETE = 3;

    private static $valueToName = [
        self::ACTION_UNSPECIFIED => 'ACTION_UNSPECIFIED',
        self::CREATE => 'CREATE',
        self::UPDATE => 'UPDATE',
        self::DELETE => 'DELETE',
    ];

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


