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

namespace Google\Cloud\Datastream\V1\BackfillJob;

use UnexpectedValueException;

/**
 * State of the stream object's backfill job.
 *
 * Protobuf type <code>google.cloud.datastream.v1.BackfillJob.State</code>
 */
class State
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Backfill job was never started for the stream object (stream has backfill
     * strategy defined as manual or object was explicitly excluded from
     * automatic backfill).
     *
     * Generated from protobuf enum <code>NOT_STARTED = 1;</code>
     */
    const NOT_STARTED = 1;
    /**
     * Backfill job will start pending available resources.
     *
     * Generated from protobuf enum <code>PENDING = 2;</code>
     */
    const PENDING = 2;
    /**
     * Backfill job is running.
     *
     * Generated from protobuf enum <code>ACTIVE = 3;</code>
     */
    const ACTIVE = 3;
    /**
     * Backfill job stopped (next job run will start from beginning).
     *
     * Generated from protobuf enum <code>STOPPED = 4;</code>
     */
    const STOPPED = 4;
    /**
     * Backfill job failed (due to an error).
     *
     * Generated from protobuf enum <code>FAILED = 5;</code>
     */
    const FAILED = 5;
    /**
     * Backfill completed successfully.
     *
     * Generated from protobuf enum <code>COMPLETED = 6;</code>
     */
    const COMPLETED = 6;
    /**
     * Backfill job failed since the table structure is currently unsupported
     * for backfill.
     *
     * Generated from protobuf enum <code>UNSUPPORTED = 7;</code>
     */
    const UNSUPPORTED = 7;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::NOT_STARTED => 'NOT_STARTED',
        self::PENDING => 'PENDING',
        self::ACTIVE => 'ACTIVE',
        self::STOPPED => 'STOPPED',
        self::FAILED => 'FAILED',
        self::COMPLETED => 'COMPLETED',
        self::UNSUPPORTED => 'UNSUPPORTED',
    ];

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


