#!/usr/bin/perl

use strict;
use Getopt::Std;
use Data::Dumper;

use lib '/app/tools/common/lib';
use Common::RSApp;
use Common::RSMath;

use lib '/app/tools/rps/lib';
use RPS::ArtistRoyalty::Job::CreateReservePipelineReport;

# Parse the command-line.
#
my %options;
parseCommandLine(\%options);

my $clientID = $options{clientID};
my $runID = $options{runID};

my $appSingleton = Common::RSApp->new(clientID => $clientID);
my $job = RPS::ArtistRoyalty::Job::CreateReservePipelineReport->new(runID => $runID, clientID => $clientID);
$job->enqueue();

#
# Boring script stuff below...
#

sub parseCommandLine
{
    my ($settings) = @_;

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

    if (! $opt{c} || ! $opt{r})
    {
        usage();
        exit(1);
    }
    $settings->{clientID} = $opt{c};
    $settings->{runID} = $opt{r};

}


sub usage
{
    print STDERR "\nusage: $0 -c <client_id> -r <run_id>\n";
    print STDERR "\n";
    print STDERR "Arguments:\n";
    print STDERR "\t-c <client_id>\t\t\tThe client_id of the client to process\n";
    print STDERR "\t-r <run_id>\tThe id of the artist royalty run to process\n";
}

