#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Statement::Mechanical::US::PDF;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use Common::Util;
use Common::RSApp;

use lib '/app/tools/rps/lib';
use RPS::Mechanical::US::MechanicalRun;
use RPS::DB::Item::MechanicalRun;
use RPS::DB::Item::MechanicalStatement;
use RPS::DB::Item::Publisher;
use RPS::Config;

use RPS::Statement::Mechanical::PDF;
use base 'RPS::Statement::Mechanical::PDF';

# !!! For now, this package will probably just contain constants and maybe static methods.
# !!! Later on down the road, I'll look at moving the actual code
# !!! that generates the statements into here.
#

sub _publisherID { return "publisher_id"; }

sub _GetPublisherIDFromDBItem
{
    my ($class, $statementDBItem) = @_;
    return $statementDBItem->publisher_id;
}

sub _BasePath
{
    my ($class) = @_;

    my $config = RPS::Config->new();
    my $path = $config->get('mechanical_royalty_statement_dir');
    return $path;
#    return '/app/data/royalty_statements/mechanical';
}

sub _GetStatementItem
{
    my ($class, $id) = @_;
    return RPS::DB::Item::MechanicalStatement->Lookup(mechanical_statement_id => $id);
}

sub _GetRunItem
{
    my ($class, $id) = @_;
    return RPS::DB::Item::MechanicalRun->Lookup(mechanical_run_id => $id);
}

sub _RunIDFromStatementItem
{
    my ($class, $statementDBItem) = @_;
    return $statementDBItem->mechanical_run_id();
}

sub _GetFileLabel
{
    my ($class, $run) = @_;

    return RPS::Mechanical::US::MechanicalRun::GenerateFileLabel($run->label);
}

sub _GetPublisher
{
    my ($class, $id) = @_;
    return RPS::DB::Item::Publisher->Lookup(publisher_id => $id);
}

1;
