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

namespace Google\Cloud\CloudDms\V1\MigrationJob;

use UnexpectedValueException;

/**
 * The current migration job phase.
 *
 * Protobuf type <code>google.cloud.clouddms.v1.MigrationJob.Phase</code>
 */
class Phase
{
    /**
     * The phase of the migration job is unknown.
     *
     * Generated from protobuf enum <code>PHASE_UNSPECIFIED = 0;</code>
     */
    const PHASE_UNSPECIFIED = 0;
    /**
     * The migration job is in the full dump phase.
     *
     * Generated from protobuf enum <code>FULL_DUMP = 1;</code>
     */
    const FULL_DUMP = 1;
    /**
     * The migration job is CDC phase.
     *
     * Generated from protobuf enum <code>CDC = 2;</code>
     */
    const CDC = 2;
    /**
     * The migration job is running the promote phase.
     *
     * Generated from protobuf enum <code>PROMOTE_IN_PROGRESS = 3;</code>
     */
    const PROMOTE_IN_PROGRESS = 3;
    /**
     * Only RDS flow - waiting for source writes to stop
     *
     * Generated from protobuf enum <code>WAITING_FOR_SOURCE_WRITES_TO_STOP = 4;</code>
     */
    const WAITING_FOR_SOURCE_WRITES_TO_STOP = 4;
    /**
     * Only RDS flow - the sources writes stopped, waiting for dump to begin
     *
     * Generated from protobuf enum <code>PREPARING_THE_DUMP = 5;</code>
     */
    const PREPARING_THE_DUMP = 5;

    private static $valueToName = [
        self::PHASE_UNSPECIFIED => 'PHASE_UNSPECIFIED',
        self::FULL_DUMP => 'FULL_DUMP',
        self::CDC => 'CDC',
        self::PROMOTE_IN_PROGRESS => 'PROMOTE_IN_PROGRESS',
        self::WAITING_FOR_SOURCE_WRITES_TO_STOP => 'WAITING_FOR_SOURCE_WRITES_TO_STOP',
        self::PREPARING_THE_DUMP => 'PREPARING_THE_DUMP',
    ];

    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(Phase::class, \Google\Cloud\CloudDms\V1\MigrationJob_Phase::class);

