package BookPub::Import::Importer::Chegg::Version19;

use strict;
use warnings;

use base 'BookPub::Import::Importer::Chegg::Version18';

sub _fieldMap {
    {
        dateBegin     => 'B',
        dateEnd       => 'B',
        rPurchaseType => 'S',
        purchaseType  => 'S',
        rProductType  => 'S',
        rTitle        => 'E',
        rIsbn10       => 'H',
        rIsbn13       => 'G',
        rInstitution  => 'N',
        rState        => 'P',
        rPostalCode   => 'Q',
        countryCode   => 'R',
        rReturns      => 'I',
        rListPrice    => 'J',
        rRevenue      => 'L',
        rComments     => 'K',
    };
}
sub priceType { 'rrp' }

sub purchaseType {
    my $self = shift;

    my $type = $self->_getByFieldName('purchaseType') || '';
    return BookPub::DB::Item::Sale::kPurchaseTypeSubscriptionDL if $type =~ /^Ebook_Subscription$/i;

    $self->fail("Unable to determine purchase_type from: '$type'.");
}

sub rProductType {
    my $self = shift;

    my $type = $self->_getByFieldName('rProductType') || '';
    return BookPub::DB::Item::Sale::kProductTypeEBook if $type =~ /^Ebook_Subscription$/i;

    $self->fail("Unable to determine product_type from: '$type'.");
}


1;
