<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/bigquery/migration/v2/migration_entities.proto

namespace Google\Cloud\BigQuery\Migration\V2\MigrationWorkflow;

use UnexpectedValueException;

/**
 * Possible migration workflow states.
 *
 * Protobuf type <code>google.cloud.bigquery.migration.v2.MigrationWorkflow.State</code>
 */
class State
{
    /**
     * Workflow state is unspecified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Workflow is in draft status, i.e. tasks are not yet eligible for
     * execution.
     *
     * Generated from protobuf enum <code>DRAFT = 1;</code>
     */
    const DRAFT = 1;
    /**
     * Workflow is running (i.e. tasks are eligible for execution).
     *
     * Generated from protobuf enum <code>RUNNING = 2;</code>
     */
    const RUNNING = 2;
    /**
     * Workflow is paused. Tasks currently in progress may continue, but no
     * further tasks will be scheduled.
     *
     * Generated from protobuf enum <code>PAUSED = 3;</code>
     */
    const PAUSED = 3;
    /**
     * Workflow is complete. There should not be any task in a non-terminal
     * state, but if they are (e.g. forced termination), they will not be
     * scheduled.
     *
     * Generated from protobuf enum <code>COMPLETED = 4;</code>
     */
    const COMPLETED = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::DRAFT => 'DRAFT',
        self::RUNNING => 'RUNNING',
        self::PAUSED => 'PAUSED',
        self::COMPLETED => 'COMPLETED',
    ];

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


