<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/logging/v2/logging_config.proto

namespace Google\Cloud\Logging\V2;

use UnexpectedValueException;

/**
 * LogBucket lifecycle states.
 *
 * Protobuf type <code>google.logging.v2.LifecycleState</code>
 */
class LifecycleState
{
    /**
     * Unspecified state. This is only used/useful for distinguishing unset
     * values.
     *
     * Generated from protobuf enum <code>LIFECYCLE_STATE_UNSPECIFIED = 0;</code>
     */
    const LIFECYCLE_STATE_UNSPECIFIED = 0;
    /**
     * The normal and active state.
     *
     * Generated from protobuf enum <code>ACTIVE = 1;</code>
     */
    const ACTIVE = 1;
    /**
     * The resource has been marked for deletion by the user. For some resources
     * (e.g. buckets), this can be reversed by an un-delete operation.
     *
     * Generated from protobuf enum <code>DELETE_REQUESTED = 2;</code>
     */
    const DELETE_REQUESTED = 2;
    /**
     * The resource has been marked for an update by the user. It will remain in
     * this state until the update is complete.
     *
     * Generated from protobuf enum <code>UPDATING = 3;</code>
     */
    const UPDATING = 3;
    /**
     * The resource has been marked for creation by the user. It will remain in
     * this state until the creation is complete.
     *
     * Generated from protobuf enum <code>CREATING = 4;</code>
     */
    const CREATING = 4;
    /**
     * The resource is in an INTERNAL error state.
     *
     * Generated from protobuf enum <code>FAILED = 5;</code>
     */
    const FAILED = 5;

    private static $valueToName = [
        self::LIFECYCLE_STATE_UNSPECIFIED => 'LIFECYCLE_STATE_UNSPECIFIED',
        self::ACTIVE => 'ACTIVE',
        self::DELETE_REQUESTED => 'DELETE_REQUESTED',
        self::UPDATING => 'UPDATING',
        self::CREATING => 'CREATING',
        self::FAILED => 'FAILED',
    ];

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

