package LATMOS::Accounts::Task;

use strict;
use warnings;
use LATMOS::Accounts::Log;

sub new {
    my ($class, $module, %options) = @_;
    my $pclass = ucfirst(lc($module));
    my $me = __PACKAGE__;
    eval "require ${me}::$pclass;";
    if ($@) { return } # error message ?
    return "${me}::$pclass"->_new(%options);
}

sub _new {
    my ($class, %options) = @_;
    bless { %options }, $class;
}

sub init {
    return 1;
}

sub needupd {
    my ($self, $baserev, $syncm) = @_;

    la_log LA_DEBUG, "Comparing db: %d <=> %d", $syncm->dbrev, $baserev;
    if ($syncm->dbrev > $baserev) {
        return 1;
    } else {
        la_log LA_DEBUG, "No change in DB, doing nothing";
        return;
    }
}

sub run {
    return 1;
}

sub post {
}

1;
