package BookPub::POS::Import::Importer::Amazon::Version1;

use strict;

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

sub _headerIdentifier { ( rTitle => 'title name' ) }

sub _fieldMap {
    {
        serviceProductID => 'B',
        dateBegin        => 'I',
        isbn             => 'C',
        rTitle           => 'D',
        rAuthor          => 'F',
        rUnits           => 'J',
        rListPrice       => 'G',
        rUnitPrice       => 'H',
    };
}

sub currencyCode { 'USD' }
sub countryCode  { 'US' }

sub priceType    { 'agency' }
sub purchaseType { BookPub::DB::Item::Sale::kPurchaseTypeDownload }
sub productType  { BookPub::DB::Item::Sale::kProductTypeEBook }

sub rRevenue {
    my $self      = shift;
    my $units     = $self->rUnits();
    my $unitPrice = $self->rUnitPrice();

    return $units * $unitPrice;
}

1;
