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

namespace Google\Cloud\Vision\V1\OperationMetadata;

use UnexpectedValueException;

/**
 * Batch operation states.
 *
 * Protobuf type <code>google.cloud.vision.v1.OperationMetadata.State</code>
 */
class State
{
    /**
     * Invalid.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Request is received.
     *
     * Generated from protobuf enum <code>CREATED = 1;</code>
     */
    const CREATED = 1;
    /**
     * Request is actively being processed.
     *
     * Generated from protobuf enum <code>RUNNING = 2;</code>
     */
    const RUNNING = 2;
    /**
     * The batch processing is done.
     *
     * Generated from protobuf enum <code>DONE = 3;</code>
     */
    const DONE = 3;
    /**
     * The batch processing was cancelled.
     *
     * Generated from protobuf enum <code>CANCELLED = 4;</code>
     */
    const CANCELLED = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::CREATED => 'CREATED',
        self::RUNNING => 'RUNNING',
        self::DONE => 'DONE',
        self::CANCELLED => '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);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(State::class, \Google\Cloud\Vision\V1\OperationMetadata_State::class);

