package RPS::Import::ADA::v20;

use strict;

use Date::Calc qw(Days_in_Month Decode_Month);
use Data::Dumper;

use lib '/app/tools/common/lib';
use Common::Util qw(normalize_date normalize_upc);
use Common::Country;

use lib '/app/tools/data_classes/lib';

use lib '/app/tools/rps/lib';
use RPS::File::Sale;
use RPS::Import::ServiceMap;

use base 'RPS::Import::ADA::v13';

sub _fieldMap {

    my $self = shift;

    my $sheetName = lc $self->{sheetname};

    # Need to be able to accept flat files too.
    if ( !$sheetName ) {
        $sheetName = 'digital sales';
    }

    my %fieldMaps = (
        'statement summary' => {},

        'digital sales' => {
            label            => 0,     # A
            serviceID        => 12,    # M
            countryCode      => 14,    # O
            productType      => 6,     # G
            formatType       => 16,    # Q
            serviceProductID => 10,    # K
            artistName       => 4,     # E
            upc              => 7,     # H

            albumName => 3,            # D
            trackName => 5,            # F

            isrc  => 8,                # I
            units => 19,               # T
            price => 24,               # Y
        },
    );

    if ( $fieldMaps{$sheetName} ) {
        return $fieldMaps{$sheetName};
    } else {
        print STDERR "ADA v20: Illegal sheet '$sheetName'\n";
        die "Sheet '$sheetName' is not valid";
    }
}

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