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

namespace Google\Cloud\Logging\V2;

use UnexpectedValueException;

/**
 * List of different operation states.
 * High level state of the operation. This is used to report the job's
 * current state to the user. Once a long running operation is created,
 * the current state of the operation can be queried even before the
 * operation is finished and the final result is available.
 *
 * Protobuf type <code>google.logging.v2.OperationState</code>
 */
class OperationState
{
    /**
     * Should not be used.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_UNSPECIFIED = 0;</code>
     */
    const OPERATION_STATE_UNSPECIFIED = 0;
    /**
     * The operation is scheduled.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_SCHEDULED = 1;</code>
     */
    const OPERATION_STATE_SCHEDULED = 1;
    /**
     * Waiting for necessary permissions.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_WAITING_FOR_PERMISSIONS = 2;</code>
     */
    const OPERATION_STATE_WAITING_FOR_PERMISSIONS = 2;
    /**
     * The operation is running.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_RUNNING = 3;</code>
     */
    const OPERATION_STATE_RUNNING = 3;
    /**
     * The operation was completed successfully.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_SUCCEEDED = 4;</code>
     */
    const OPERATION_STATE_SUCCEEDED = 4;
    /**
     * The operation failed.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_FAILED = 5;</code>
     */
    const OPERATION_STATE_FAILED = 5;
    /**
     * The operation was cancelled by the user.
     *
     * Generated from protobuf enum <code>OPERATION_STATE_CANCELLED = 6;</code>
     */
    const OPERATION_STATE_CANCELLED = 6;

    private static $valueToName = [
        self::OPERATION_STATE_UNSPECIFIED => 'OPERATION_STATE_UNSPECIFIED',
        self::OPERATION_STATE_SCHEDULED => 'OPERATION_STATE_SCHEDULED',
        self::OPERATION_STATE_WAITING_FOR_PERMISSIONS => 'OPERATION_STATE_WAITING_FOR_PERMISSIONS',
        self::OPERATION_STATE_RUNNING => 'OPERATION_STATE_RUNNING',
        self::OPERATION_STATE_SUCCEEDED => 'OPERATION_STATE_SUCCEEDED',
        self::OPERATION_STATE_FAILED => 'OPERATION_STATE_FAILED',
        self::OPERATION_STATE_CANCELLED => 'OPERATION_STATE_CANCELLED',
    ];

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

