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

namespace Couchbase\Protostellar\Generated\Query\V1\QueryResponse\MetaData;

use UnexpectedValueException;

/**
 * Protobuf type <code>couchbase.query.v1.QueryResponse.MetaData.Status</code>
 */
class Status
{
    /**
     * Generated from protobuf enum <code>STATUS_RUNNING = 0;</code>
     */
    const STATUS_RUNNING = 0;
    /**
     * Generated from protobuf enum <code>STATUS_SUCCESS = 1;</code>
     */
    const STATUS_SUCCESS = 1;
    /**
     * Generated from protobuf enum <code>STATUS_ERRORS = 2;</code>
     */
    const STATUS_ERRORS = 2;
    /**
     * Generated from protobuf enum <code>STATUS_COMPLETED = 3;</code>
     */
    const STATUS_COMPLETED = 3;
    /**
     * Generated from protobuf enum <code>STATUS_STOPPED = 4;</code>
     */
    const STATUS_STOPPED = 4;
    /**
     * Generated from protobuf enum <code>STATUS_TIMEOUT = 5;</code>
     */
    const STATUS_TIMEOUT = 5;
    /**
     * Generated from protobuf enum <code>STATUS_CLOSED = 6;</code>
     */
    const STATUS_CLOSED = 6;
    /**
     * Generated from protobuf enum <code>STATUS_FATAL = 7;</code>
     */
    const STATUS_FATAL = 7;
    /**
     * Generated from protobuf enum <code>STATUS_ABORTED = 8;</code>
     */
    const STATUS_ABORTED = 8;
    /**
     * Generated from protobuf enum <code>STATUS_UNKNOWN = 9;</code>
     */
    const STATUS_UNKNOWN = 9;

    private static $valueToName = [
        self::STATUS_RUNNING => 'STATUS_RUNNING',
        self::STATUS_SUCCESS => 'STATUS_SUCCESS',
        self::STATUS_ERRORS => 'STATUS_ERRORS',
        self::STATUS_COMPLETED => 'STATUS_COMPLETED',
        self::STATUS_STOPPED => 'STATUS_STOPPED',
        self::STATUS_TIMEOUT => 'STATUS_TIMEOUT',
        self::STATUS_CLOSED => 'STATUS_CLOSED',
        self::STATUS_FATAL => 'STATUS_FATAL',
        self::STATUS_ABORTED => 'STATUS_ABORTED',
        self::STATUS_UNKNOWN => 'STATUS_UNKNOWN',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Status::class, \Couchbase\Protostellar\Generated\Query\V1\QueryResponse_MetaData_Status::class);

