package RPS::Import::Bandcamp::v39;

use strict;
use warnings;

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

use base 'RPS::Import::Bandcamp::v32';

sub physical { 2 }

sub _fieldMapExtended {
    {
        mixed => {
            option1 => {
                labelName       => 'J',
                countryCode     => 'K',
                dateBegin       => 'V',
                dateEnd         => 'W',
                formatType      => 'E',
                clientProductID => 'A',
                artistName      => 'I',
                upc             => 'B',
                albumName       => 'G',
                isrc            => 'C',
                trackName       => 'F',
                units           => 'L',
                currencyCode    => 'M',
                totalRevenue    => 'T',
                price           => 'T',
            },
        },
    };
}

sub _unverifiedFieldMapExtended {
    {
        mixed => {
            option1 => {
                _productTypePhys => 'H',
                _productTypeDig  => 'E',
                _netUnits        => 'L',
            },
        }
    };
}

sub _headerIdentifierExtended {
    {
        mixed => {
            option1 => {
                upc => 'UPC',
            },
        },
    };
}

sub serviceID   { Client::Service::DSP_BANDCAMP }

sub _isValidSaleRecord {
    my $self = shift;

    return ( $self->_getByFieldName('trackName') || $self->_getByFieldName('albumName') )
           && $self->netUnits
}

1;
