#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case);
use Perun::Agent;
use Perun::Common qw(printMessage);

sub help {
	return qq{
Removes NotifRegex from db by id. Id is required field.
------------------------
Available options:
 --NotifRegexId         | -i NotifRegex id
 --batch                | -b batch
 --help                 | -h prints this help

};
}

our $batch;
my $id;
GetOptions ("help|h"   => sub {
		print help();
		exit 0;
	}, "batch|b"       => \$batch,
	"NotifRegexId|i=i" => \$id) || die help();

# Check options
unless (defined($id)) { die "ERROR: NotifRegex: Id is required \n";}

my $agent = Perun::Agent->new();
my $notifAgent = $agent->getNotificationsAgent();

$notifAgent->removePerunNotifRegexById( id => $id );

#output
printMessage("NotifRegex Id:$id successfully removed.", $batch);
