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

package RPS::ArtistRoyalty::Fast::TermType::Fixed;

use strict;
use lib '/app/tools/rps/lib';

use base 'RPS::ArtistRoyalty::Fast::TermType::Base';

use RPS::ArtistRoyalty::Fast::Final::ArtistRoyaltyIncomeItem;

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

    # For a fixed rate term, the rate _is_ the price.
    # Since we multiply the price with the rate later, just set
    # this to 1.
    #
    return 1;
}

sub _calcNetRate {
    my ( $self, $incomeItem ) = @_;
    my $netRate = $incomeItem->[RPS::ArtistRoyalty::Fast::Final::ArtistRoyaltyIncomeItem::kPrice];

    return ( $netRate * $incomeItem->[RPS::ArtistRoyalty::Fast::Final::ArtistRoyaltyIncomeItem::kRate] );
}

1;
