package BookPub::Import::Importer::Gardners::Version2;

use strict;

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

use Date::Calc qw( Add_Delta_YM );

sub _headerIdentifier { ( rTitle => 'TITLE' ) }

sub _fieldMap {
    {
        currencyCode => 'H',
        countryCode  => 'G',
        dateBegin    => 'N',
        rFormat      => 'B',
        rIsbn13      => 'A',
        rTitle       => 'C',
        rUnits       => 'E',
        rListPrice   => 'I',
        rRevenue     => 'J',
    };
}

sub priceType    { 'rrp' }
sub purchaseType { BookPub::DB::Item::Sale::kPurchaseTypeDownload }
sub productType  { BookPub::DB::Item::Sale::kProductTypeEBook }
sub _dateFormat  { [ 'eur', 'iso' ] }

sub _parseFormat {
    my ( $self, $type ) = @_;
    return $type =~ /EPUB/i
      ? BookPub::DB::Item::Sale::kFormatTypeEPub
      : return $self->SUPER::_parseFormat($type);
}

1;
