package BookPub::Import::Importer::Scribd::Version1;

use strict;

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

sub _headerIdentifier { ( rIsbn13 => 'ISBN' ) }

sub purchaseType { BookPub::DB::Item::Sale::kPurchaseTypeDownload }
sub priceType    { 'rrp' }
sub rServiceName { 'Scribd' }
sub currencyCode { 'USD' }
sub countryCode  { 'US' }
sub productType  { BookPub::DB::Item::Sale::kProductTypeEBook }
sub rUnits       { 1 }

sub _fieldMap {
    {
        dateBegin  => 'A',
        rTitle     => 'B',
        rIsbn13    => 'C',
        rListPrice => 'D',
        rRevenue   => 'E',

        #    rDiscount             => 'G',
    };
}

sub _isValidSaleRecord {
    my $self = shift;

    return $self->rTitle && $self->dateBegin;
}

sub rRevenue {
    my $self = shift;

    my $revenue = $self->SUPER::rRevenue();

    $revenue =~ s/,|\$//g;

    return $revenue;
}

sub rListPrice {
    my $self = shift;

    my $listPrice = $self->SUPER::rListPrice();

    $listPrice =~ s/,|\$//g;

    return $listPrice;
}

1;
