#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------

package RPS::Mechanical::UK::Process::CreateStatement::Mcps::DVD1;

# This class will serve as the base class for the processes that create
# MCPS statements.  There should be a fair amount of common code, so that
# will go here.
#
# The basic idea is the overall 'flow' will be defined here.  Meaning, the
# essential steps will be encapsulated as abstract methods which subclasses
# will override.  And there will be a 'createStatement' method that is implemented
# here in terms of these abstract methods.
#

use strict;
use lib '/app/tools/rps/lib';
use RPS::Mechanical::UK::Process::CreateStatement;
use RPS::DB::Item::SaleRunMap;
use RPS::DB::Item::McpsLicense;
use base 'RPS::Mechanical::UK::Process::CreateStatement::Mcps';

sub _licenseTypeMatches {
    my ( $self, $license ) = @_;

    if ( $license->dvd_category() eq RPS::DB::Item::McpsLicense::kDVDCategoryAVP ) {
        return undef;
    }

    return 1;
}

sub _getSaleIDs {
    my ($self) = @_;
    my $run = $self->_getRunDBItem();

    my $sales = Raptor::DB::Item::Sale->GetUnprocessedDVD1SaleIDs( ending_sale_date => $run->ending_sale_date() );

    return $self->_getUnprocessedSales($sales);
}

sub _getProcessedSales {
    my ($self) = @_;
    my %hash;

    return RPS::DB::Item::SaleRunMap->GetPaidUKMechanicalDVD1();
}

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

    # Return ALL DVD1 licenses.
    #
    return RPS::DB::Item::McpsLicense->GetAllDVD1Licenses( payorID => $self->_payorID() );
}

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

    return 100;
}

1;
