package BookPub::Import::Importer::Wheelers::Version2;

use strict;

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

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

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

sub _fieldMap {
    {
        currencyCode => 'M',
        countryCode  => 'N',
        dateBegin    => 'B',
        rFormat      => 'D',
        rIsbn13      => 'C',
        rTitle       => 'E',
        rAuthor      => 'F',
        rUnits       => 'G',
        rListPrice   => 'I',
        rDiscount    => 'J',
        rUnitPrice   => 'K',
        rRevenue     => 'L',
    };
}

sub _isSaleRec {
    my $self = shift;

    # we require a title, ISBN, and author for a valid record
    ( $self->rTitle || $self->rIsbn13 || $self->rAuthor ) || return 0;
    return 1;
}

###
1;    # Play nicely.
###
