#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2011 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Analytics::ProductMonitor::Data::UnitsFromRevenueFiles;
use strict;

use Date::Calc;

use lib '/app/tools/common/lib';
use lib '/app/tools/bookpub/lib';
use Common::XMLObject;
use Common::Assert;
use Common::Log;
use Common::Client;
use BookPub::DB::Item::PriceType;
use BookPub::DB::Item::SaleUnits;

use base 'BookPub::Analytics::ProductMonitor::Data';

sub _currentDataCarriesOver {
    my ($self) = @_;

    # We don't carry over current data in this class.
    #
    return 0;
}

sub _getServiceDataCollection {
    my ( $self, $serviceID, $productIDs ) = @_;

    # !!! We'll probably need to constrain this query further using the dates.
    #
    my $collection = BookPub::DB::Item::SaleUnits->ReportQuery( $productIDs, $serviceID, $self->{dateStart}, $self->{dateEnd} );
    return $collection;
}

sub _dataElementFromItem {
    my ( $self, $item ) = @_;

    return $item->units();
}

sub _dateFromItem {
    my ( $self, $item ) = @_;
    return $item->date();
}

###
1;    # Play nicely;
###
