#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2012 RoyaltyShare, Inc.   All Rights Reserved
#---------------------------------------------------------------

package RPS::ArtistRoyalty::Fast::Static::ContractTitleArtists;

use strict;
use Data::Dumper;
use File::Path;

use lib '/app/tools/common/lib';
use lib '/app/tools/rps/lib';
use lib '/app/tools/raptor/lib';
use Common::RSApp;

use Common::Log;

# This is not a typical, staged data class.
# Instead this just wraps around a ram-cached query.
#
# JPK - But does it hurt to have it derive from the standard base class?
# I want to keep the EscapeArray method there...
#
use base 'RPS::ArtistRoyalty::Fast::Static';

use constant kArtistContractID    => 0;
use constant kArtistContractTitle => 1;

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

    my $sql = qq/
    select
    new_artist_contract.artist_contract_id,
    new_artist_contract.title
    from new_artist_contract
    where new_artist_contract.deleted = 0
    /;

    my %data;
    my $dbo = Common::RSApp::GetClientDB();
    my $sth = $dbo->DoCmd($sql);
    while ( my @result = $sth->fetchrow_array() ) {
        my $escapedArray = $class->EscapeArray( \@result );
        $data{ $result[kArtistContractID] } = $escapedArray;
    }

    return \%data;
}

1;

