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

package RPS::ArtistRoyalty::Fast::TermType::Average;

use strict;
use lib '/app/tools/rps/lib';
use RPS::ArtistRoyalty::Fast::Static::Sales;
use base 'RPS::ArtistRoyalty::Fast::TermType::Base';

sub _getPriceLevel {
    my ( $self, $sale, $productTerm ) = @_;

    my $priceLevel = $self->SUPER::_getPricelevel( $sale, $productTerm );

    # !!! Log it if we didn't get one...
    # !!! Might want to actually throw an exception.
    #
}

sub _getPrice {
    my ( $self, $sale, $priceLevel, $productPrices ) = @_;

    # The price is always the 'average price', which is what we store
    # in the sale record.
    #
    return $sale->[RPS::ArtistRoyalty::Fast::Static::Sales::kAveragePrice];
}

1;
