package BookPub::Import::Importer::Numilog::Version4;

use strict;
use warnings;

use lib '/app/tools/bookpub/lib';
use base 'BookPub::Import::Importer::Numilog';

sub _fieldMap {
    {
        rFormat            => 'I',
        rTitle             => 'C',
        rIsbn13            => 'H',
        countryCode        => 'W',
        rUnits             => 'J',
        rListPrice         => 'Z',
        rListPriceCurrency => 'Z1',
        rPurchasePrice     => 'Y',
        rDiscount          => 'S',
        rRevenue           => 'Q',
        currencyCode       => 'R1',
        rChannel           => 'AB',
        rModel             => 'AA',
        rComments          => 'AD',
    };
}

sub _unverifiedFieldMap {
    {
        authorLastName  => 'E',
        authorFirstName => 'F',
    };
}

sub rServiceName { 'Numilog' }

# Need to override the base class here
sub rPurchasePriceCurrency { 'EUR' }
sub rTaxAmount             { }
sub rTaxUnitPrice          { }

sub countryCode {
    my $self = shift;

    my $countryCode = $self->_getByFieldName('countryCode') || '';
    return $countryCode;
}

sub isFree {
    my $self = shift;

    return !$self->rRevenue && $self->rUnits ? 'Y' : 'N';
}

1;
