#!/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{
	Unsets specific User. User id is required.
	--------------------------------------
	Available options:
	--userId       | -u specific user id
	--specUserType | -t type of specific user (SERVICE/SPONSORED)
	--batch        | -b batch
	--help         | -h prints this help

	};
}

my ($userId, $specUsrType, $batch);
GetOptions ("help|h"  => sub {
		print help();
		exit 0;
	}, "batch|b"        => \$batch,
	"userId|u=i"        => \$userId, 
	"specUserType|t=s"  => \$specUsrType ) || die help();

# Check options
unless (defined($userId)) { die "ERROR: specificUserId is required \n";}
unless (defined($specUsrType)) { die "ERROR: specUserType is required \n";}

my $agent = Perun::Agent->new();
my $usersAgent = $agent->getUsersAgent;

$usersAgent->unsetSpecificUser( specificUser => $userId, specificUserType => $specUsrType );

printMessage("Specific user Id: $userId successfully unset", $batch);
