package BookPub::Import::Importer::Follett_Higher_Education::Version1;

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 productType  { BookPub::DB::Item::Sale::kProductTypeEBook }
sub priceType    { 'rrp' }
sub currencyCode { 'USD' }
sub countryCode  { 'US' }

sub _fieldMap {
    {
        dateBegin    => 'C',
        rIsbn13      => 'E',
        rAuthor      => 'J',
        rTitle       => 'K',
        rRevenue     => 'L',
        rListPrice   => 'M',
        purchaseType => 'N',
        rPostalCode  => 'P',
    };
}

sub rUnits {
    my $self = shift;
    my $type = $self->_getByFieldName('purchaseType');

    if ( $type eq 'Sale' ) {
        return 1;
    } else {
        die "purchaseType other than Sale found: $type";
    }
}

1;
