package BookPub::Import::Importer::IngramDigitalLSI;

use strict;

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

sub _fieldMap {
    my $self = shift;

    my %fieldMap = (
        5 => {
            dateBegin        => 'N',
            dateEnd          => 'N',
            rAuthor          => 'F',
            rTitle           => 'E',
            rIsbn13          => 'C',
            rInstitution     => 'U',
            rState           => 'W',
            rPostalCode      => 'X',
            countryCode      => 'Y',
            serviceProductID => 'D',
            rUnits           => 'K',
            rRevenue         => 'L',
            currencyCode     => 'M',
            rChannel         => 'T',
        },
    );

    return $fieldMap{ $self->_version() };
}

sub _headerIdentifier { ( rIsbn13 => 'isbn' ) }
sub _autoParseTitleAndSubtitle { 1 }
sub purchaseType               { BookPub::DB::Item::Sale::kPurchaseTypePrintOnDemand }
sub priceType                  { 'rrp' }
sub productType                { BookPub::DB::Item::Sale::kProductTypePhysicalBook }
sub rListPriceCurrency         { 'USD' }
sub _useIsSaleRec              { 1 }
sub _dateFormat                { ['text'] }
sub _dateNormalization         { 'month' }

sub _getDateBegin {
    my $self = shift;
    my $date = $self->_getByFieldName('dateBegin');

    $date =~ s/'//;

    return $date;
}

sub _getDateEnd {
    my $self = shift;
    my $date = $self->_getByFieldName('dateEnd');

    $date =~ s/'//;

    return $date;
}

1;

