package BookPub::Import::Importer::Amazon::Version76;

use strict;
use warnings;

use parent 'BookPub::Import::Importer::Amazon::Version5';

sub _headerIdentifier { rTitle => qr/.*\(Title\)$/ }

sub _fieldMap {
    {
        dateBegin              => 'A',
        serviceProductID       => 'B',
        currencyCode           => 'U',
        countryCode            => 'V',
        rFormat                => 'I',
        isbn                   => 'E',
        rTitle                 => 'F',
        rAuthor                => 'G',
        rImprint               => 'H',
        rUnits                 => 'L',
        rSales                 => 'J',
        rReturns               => 'K',
        rAdjustments           => 'N',
        rPurchasePrice         => 'O',
        rPurchasePriceCurrency => 'P',
        rListPrice             => 'Q',
        rListPriceCurrency     => 'R',
        rDiscount              => 'S',
        rRevenue               => 'T',
        rModel                 => 'W',
    };
}

sub isFree {
    my $self = shift;

    my $revenue = $self->_getByFieldName("rRevenue") || 0;
    my $units = $self->_getByFieldName("rUnits") || 0;

    $revenue =~ s/^0\.0+$/0/g;

    return !$revenue && $units ? 'Y' : 'N';
}

1;
