#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package Admin::Mcps::ExportUpliftCountryList;

use strict;
use warnings;
use Carp;

use Data::Dumper;

use lib '/app/tools/common/lib';
use Common::Assert;

use Common::FormObject;
use base 'Common::FormObject';

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    $self->{ExportUpliftCountry} = [];
    my $countries = RPS::DB::Item::McpsExportUplift->GetUniqueCountries();

    # We want to sort this list before displaying it,
    # but the trick is that we want to sort based on Country Name
    # not Country Code.
    #
    my %countriesSorted = ();

    while ( $countries->hasNext() ) {
        my $data = $countries->next();

        $countriesSorted{ RPS::CountryList::CountryNameFor( $data->country_code ) } = $data->country_code;
    }

    foreach my $country ( sort keys %countriesSorted ) {
        push @{ $self->{ExportUpliftCountry} }, $countriesSorted{$country};
    }

    return $self;
}

sub _listProperties {
    return { ExportUpliftCountry => 1 };
}

###
1;    #
###
