#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::DB::Item::McpsExportUplift;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use Common::DB::ItemCollection;
use Common::DB::Item;
use base 'Common::DB::Item';

use constant kTable => 'mcps_export_uplift';
use constant kDB    => Common::DB::Item::kClientDB();

sub GetAllSortedByCountry {
    my ( $class, $countryCode ) = @_;

    my $sql = "SELECT * FROM " . kTable;
    if ($countryCode) {
        $sql .= " WHERE country_code = '$countryCode'";
    }

    return $class->SUPER::GetAll($sql);

}

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

    my $sql = "SELECT DISTINCT country_code FROM " . kTable;

    return $class->SUPER::GetAll($sql);

}

sub ResetProductTypeIDs {
    my $class = shift;

    my $dbo = Common::RSApp::GetClientDB();
    $dbo->DoCmd( 'UPDATE ' . kTable . ' SET product_type_id = NULL' );

    return 1;
}

1;

