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

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::CA::MechanicalRun;
use RPS::DB::Item::CAMechanicalRun;
use RPS::DB::Item::CAMechanicalStatement;
use RPS::DB::Item::CAPublisher;
use RPS::Config;

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

# !!! 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 _GetPublisherIDFromDBItem
{
    my ($class, $statementDBItem) = @_;
    return $statementDBItem->ca_publisher_id;
}

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

    # !!! Use config file 
    #
    my $config = RPS::Config->new();
    my $path = $config->get('ca_mechanical_royalty_statement_dir');
    return $path;
#    return '/app/data/royalty_statements/ca_mechanical';
}

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

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

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

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

    return RPS::Mechanical::CA::MechanicalRun::GenerateFileLabel($run);
}

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

1;
