<?php
/**
 * Import Wizard Controller.
 *
 * @package PrimeLink
 */

namespace PrimeLink\Modules\Imports\Controller;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

final class ImportWizardController {

    const TOTAL_STEPS = 8;

    /**
     * Get current step from request.
     *
     * @return int
     */
    public static function get_step() {
        $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
        if ( $step < 1 ) {
            $step = 1;
        }
        if ( $step > self::TOTAL_STEPS ) {
            $step = self::TOTAL_STEPS;
        }
        return $step;
    }

    /**
     * Get current import draft id.
     *
     * @return int
     */
    public static function get_import_id() {
        return isset( $_GET['import_id'] ) ? absint( $_GET['import_id'] ) : 0;
    }
}