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

namespace Google\Cloud\DocumentAI\V1\BatchProcessMetadata;

use UnexpectedValueException;

/**
 * Possible states of the batch processing operation.
 *
 * Protobuf type <code>google.cloud.documentai.v1.BatchProcessMetadata.State</code>
 */
class State
{
    /**
     * The default value. This value is used if the state is omitted.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Request operation is waiting for scheduling.
     *
     * Generated from protobuf enum <code>WAITING = 1;</code>
     */
    const WAITING = 1;
    /**
     * Request is being processed.
     *
     * Generated from protobuf enum <code>RUNNING = 2;</code>
     */
    const RUNNING = 2;
    /**
     * The batch processing completed successfully.
     *
     * Generated from protobuf enum <code>SUCCEEDED = 3;</code>
     */
    const SUCCEEDED = 3;
    /**
     * The batch processing was being cancelled.
     *
     * Generated from protobuf enum <code>CANCELLING = 4;</code>
     */
    const CANCELLING = 4;
    /**
     * The batch processing was cancelled.
     *
     * Generated from protobuf enum <code>CANCELLED = 5;</code>
     */
    const CANCELLED = 5;
    /**
     * The batch processing has failed.
     *
     * Generated from protobuf enum <code>FAILED = 6;</code>
     */
    const FAILED = 6;

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


