package BookPub::Import::Importer::OneClickdigital::Version5;

use strict;

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

sub _fieldMap {
    {
        dateBegin          => 'A',
        dateEnd            => 'A',
        rAuthor            => 'D',
        rTitle             => 'C',
        rIsbn13            => 'B',
        countryCode        => 'K',
        rUnits             => 'F',
        rListPrice         => 'G',
        rListPriceCurrency => 'J',
        rDiscount          => 'H',
        rRevenue           => 'I',
        currencyCode       => 'J',
    };
}

sub purchaseType           { BookPub::DB::Item::Sale::kPurchaseTypeSubscriptionDL }
sub productType            { BookPub::DB::Item::Sale::kProductTypeEBook }
sub priceType              { 'rrp' }
sub rPurchasePriceCurrency { }
sub rListPriceCurrency     { shift->currencyCode }

sub currencyCode {
    my $self     = shift;
    my $currency = $self->_getByFieldName('currencyCode');

    if ( $currency =~ /^AUS$/i ) {
        $currency = "AUD";
    }

    return $currency;
}

1;
