package BookPub::Import::Importer::Kno::Version3;

use strict;

use Data::Dumper;

use lib '/app/tools/sale_import/lib/';
use Import::ValidationError;

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

sub _fieldMap {
    {
        purchaseType       => 'D',
        currencyCode       => 'M',
        countryCode        => 'L',
        rState             => 'R',
        rPostalCode        => 'S',
        isbn               => 'B',
        rTitle             => 'O',
        rAuthor            => 'N',
        rImprint           => 'P',
        rUnits             => 'H',
        rSales             => 'E',
        rReturns           => 'G',
        rListPriceCurrency => 'M',
        rDiscount          => 'J',
        rRevenue           => 'K',
    };
}

sub _unverifiedFieldMap {
    {
        totalPrice => 'I',
        rRented    => 'F',
    };
}

sub listPrice {
    my $self       = shift;
    my $units      = $self->_getByFieldName('rUnits');
    my $totalPrice = $self->_getByFieldName('totalPrice');
    $totalPrice =~ s/\-|,|\$|\(|\)//g;

    my $listPrice = abs( $totalPrice / $units );

    return $listPrice;
}

###
1;    # Play nicely.
###
