<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/datastore/admin/v1/migration.proto

namespace Google\Cloud\Datastore\Admin\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * An event signifying the start of a new step in a [migration from Cloud
 * Datastore to Cloud Firestore in Datastore
 * mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
 *
 * Generated from protobuf message <code>google.datastore.admin.v1.MigrationProgressEvent</code>
 */
class MigrationProgressEvent extends \Google\Protobuf\Internal\Message
{
    /**
     * The step that is starting.
     * An event with step set to `START` indicates that the migration
     * has been reverted back to the initial pre-migration state.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationStep step = 1;</code>
     */
    private $step = 0;
    protected $step_details;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $step
     *           The step that is starting.
     *           An event with step set to `START` indicates that the migration
     *           has been reverted back to the initial pre-migration state.
     *     @type \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails $prepare_step_details
     *           Details for the `PREPARE` step.
     *     @type \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails $redirect_writes_step_details
     *           Details for the `REDIRECT_WRITES` step.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Datastore\Admin\V1\Migration::initOnce();
        parent::__construct($data);
    }

    /**
     * The step that is starting.
     * An event with step set to `START` indicates that the migration
     * has been reverted back to the initial pre-migration state.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationStep step = 1;</code>
     * @return int
     */
    public function getStep()
    {
        return $this->step;
    }

    /**
     * The step that is starting.
     * An event with step set to `START` indicates that the migration
     * has been reverted back to the initial pre-migration state.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationStep step = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setStep($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\MigrationStep::class);
        $this->step = $var;

        return $this;
    }

    /**
     * Details for the `PREPARE` step.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails prepare_step_details = 2;</code>
     * @return \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails|null
     */
    public function getPrepareStepDetails()
    {
        return $this->readOneof(2);
    }

    public function hasPrepareStepDetails()
    {
        return $this->hasOneof(2);
    }

    /**
     * Details for the `PREPARE` step.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails prepare_step_details = 2;</code>
     * @param \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails $var
     * @return $this
     */
    public function setPrepareStepDetails($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\PrepareStepDetails::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Details for the `REDIRECT_WRITES` step.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails redirect_writes_step_details = 3;</code>
     * @return \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails|null
     */
    public function getRedirectWritesStepDetails()
    {
        return $this->readOneof(3);
    }

    public function hasRedirectWritesStepDetails()
    {
        return $this->hasOneof(3);
    }

    /**
     * Details for the `REDIRECT_WRITES` step.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails redirect_writes_step_details = 3;</code>
     * @param \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails $var
     * @return $this
     */
    public function setRedirectWritesStepDetails($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastore\Admin\V1\MigrationProgressEvent\RedirectWritesStepDetails::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getStepDetails()
    {
        return $this->whichOneof("step_details");
    }

}

