#!/usr/bin/perl
#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
use strict;

use Getopt::Std;

use lib '/app/tools/common/lib';
use lib '/app/tools/rps/lib';
use RPS::Portal::SendInvite;

use Common::Log;
use Common::RSApp;

# Allow tuning of the verbosity of our output.
#
my $gVerbosityLevel = 1;

Common::Log::Print(" - running with args '@ARGV'");

my %opt;
getopts( 'c:p:', \%opt );

usage("missing client ID")   if exists $opt{c} && !defined $opt{c};
usage("missing payee ID(s)") if exists $opt{p} && !defined $opt{p};

my $clientID  = $opt{c};
my $payeeList = $opt{p};

my $appSingleton = Common::RSApp->new( clientID => $clientID );
my $oInviter = RPS::Portal::SendInvite->new( payeeRecipientList => $payeeList );

$oInviter->run();

sub usage {
    my $err = shift;

    print "$err\n\n" if ($err);

    print <<EOF;
usage: $0 [-re] -c CLIENT_ID

-c CLIENT_ID : is the client ID
-p PAYEE_RECIPIENT_LIST : is the payee ID list in a format "payeeType:payeeID:recipientID,..."
EOF

    exit;
}

