package RPS::Import::Mtheory::v3;

use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::Import::ServiceMap;
use Date::Calc qw(Decode_Month Days_in_Month);

use parent 'RPS::Import::Mtheory::v2';

sub _fieldMapExtended {
    {
        digital => {
            option1 => {
                labelName   => 'I',
                serviceID   => 'Q',
                countryCode => 'E',
                productType => 'L',
                formatType  => 'K',
                artistName  => 'B',
                upc         => 'V',
                albumName   => 'A',
                isrc        => 'H',
                trackName   => 'S',
                units       => 'U',
                price       => 'O',
                mediaType   => 'J',
            },
         },
    };
}

sub _unverifiedFieldMapExtended {
    {
        digital => {
            option1 => {
                _sale_month => 'W',
                _sale_year  => 'X',
            },
        },
    };
}

sub _headerIdentifierExtended {
    {
        digital => {
            option1 => {
                upc => 'upc_ean',
            },
        },
    };
}

sub countryCode {
    my $self = shift;

    my $name = $self->_getByFieldName('countryCode') || '';
    my $country = Common::Country->Get($name) if $name;
    return $country
        ? $country->alpha2
        : $self->fail("Unable to determine country_code from: '$name'.");
}


1;
