package Cpanel::Easy::Utils::StepRegister;

# cpanel10 - Cpanel/Easy/Utils/StepRegister.pm Copyright(c) 2005-2007 cPanel, Inc.
#                                                             All rights Reserved.
# copyright@cpanel.net                                           http://cpanel.net
# This code is subject to the cpanel license.   Unauthorized copying is prohibited

use strict;
use warnings;
no warnings qw(redefine);

sub step_needs_rerun {
    my ( $self, $opt, $step ) = @_;
    return 1 if $self->get_step_run_version( $opt, $step ) ne $opt->{'version'};
    return;
}

sub step_has_run {
    my ( $self, $opt, $step ) = @_;
    my $ns = ref $opt;
    return 1 if $self->get_step_run_value( $opt, $step );
    return;
}

# TODO - Finish these four methods' storage and retrieval works ( see case 724 )

sub mark_step_complete {
    my ( $self, $opt, $step, $value ) = @_;
    my $ns = ref $opt;

    # store $ns->{ $step }{ value=>$value, version=> $opt->{'version'} }
}

sub get_step_run_value {
    my ( $self, $opt, $step ) = @_;
    my $ns = ref $opt;
    return;

    # return stored $ns->{ $step }{'value'}
}

sub get_step_run_version {
    my ( $self, $opt, $step ) = @_;
    my $ns = ref $opt;

    # return stored $ns->{ $step }{'version'}
}

sub mark_all_opts_after_this_as_run {
    my ( $self, $opt, $value ) = @_;
    my $ns  = ref $opt;
    my $aft = 0;

    for my $nss ( @{ $self->{'state'}{'order'} } ) {
        $aft = 1 if $nss eq $ns;
        next if !$aft || $nss eq $ns;

        # delete stored $nss->{}
    }
}

1;
