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

namespace Google\Cloud\Vision\V1\BatchOperationMetadata;

use UnexpectedValueException;

/**
 * Enumerates the possible states that the batch request can be in.
 *
 * Protobuf type <code>google.cloud.vision.v1.BatchOperationMetadata.State</code>
 */
class State
{
    /**
     * Invalid.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Request is actively being processed.
     *
     * Generated from protobuf enum <code>PROCESSING = 1;</code>
     */
    const PROCESSING = 1;
    /**
     * The request is done and at least one item has been successfully
     * processed.
     *
     * Generated from protobuf enum <code>SUCCESSFUL = 2;</code>
     */
    const SUCCESSFUL = 2;
    /**
     * The request is done and no item has been successfully processed.
     *
     * Generated from protobuf enum <code>FAILED = 3;</code>
     */
    const FAILED = 3;
    /**
     * The request is done after the longrunning.Operations.CancelOperation has
     * been called by the user.  Any records that were processed before the
     * cancel command are output as specified in the request.
     *
     * Generated from protobuf enum <code>CANCELLED = 4;</code>
     */
    const CANCELLED = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::PROCESSING => 'PROCESSING',
        self::SUCCESSFUL => 'SUCCESSFUL',
        self::FAILED => 'FAILED',
        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);
    }
}


