#!/usr/bin/env perl

use strict;
use warnings;

use FindBin;
use Time::Piece;

my %dataSets = (
    'tank'               => '',
    'backup'             => '',
    'remote'             => '',
);

#print zfs command
print STDERR '# zpool ' . join(' ', @ARGV) . "\n";

my $command = shift @ARGV or exit 1;

for ($command){
    /^(?:scrub)$/ && exit;

    /^list$/ && do {
        for (sort keys %dataSets){
            print "$_\n";
        }
        exit;
    };
    
    /^status$/ && do {
        exit if !exists $dataSets{$ARGV[-1]};
        my $time = localtime(int(time / 60) * 60 - 3600);
        print "  scan: scrub repaired 0 in 22h22m with 0 errors on $time\n";

        exit;
    };

    exit 1;
}

1;

