package BookPub::Import::Importer::RedShelf::Version20;

use strict;
use warnings;

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

sub _headerIdentifier { rIsbn13 => 'eISBN13' }

sub _fieldMap {
    my $self = shift;

    my %map = (
        'original_tab' => {
            dateBegin            => 'B',
            rPurchaseType        => 'V',
            purchaseType         => 'V',
            rProductType         => 'U',
            rAuthor              => 'H',
            rTitle               => 'G',
            rIsbn13              => 'I',
            rImprint             => 'F',
            rInstitution         => 'E',
            rState               => 'AA',
            rPostalCode          => 'AB',
            countryCode          => 'AC',
            rClientProductID     => 'K',
            serviceProductID     => 'J',
            rListPrice           => 'L',
            rPurchasePrice       => 'M',
            rDiscount            => 'N',
            rRevenue             => 'P',
            rTaxAmount           => 'R',
            rFee                 => 'O',
            isFree               => 'AF',
            rDuration            => 'V',
            rDeliveryMethod      => 'Y',
            rPromoCode           => 'AI',
            rChannel             => 'AK',
            rTransactionCategory => 'T',
        },
        'alternate_tab1' => {
            dateBegin            => 'B',
            rPurchaseType        => 'U',
            purchaseType         => 'U',
            rProductType         => 'T',
            productType          => 'T',
            rTitle               => 'J',
            rIsbn13              => 'K',
            rInstitution         => 'C',
            rState               => 'AG',
            rPostalCode          => 'AH',
            countryCode          => 'AI',
            rClientProductID     => 'AK',
            rUnits               => 'H',
            rListPrice           => 'M',
            rPurchasePrice       => 'N',
            rRevenue             => 'Q',
            rFee                 => 'P',
            isFree               => 'I',
            rDuration            => 'U',
            rPromoCode           => 'AJ',
            rChannel             => 'W',
            rTransactionCategory => 'V',
        }
    );

    return $self->{_tab_pattern} ? $map{ $self->{_tab_pattern} } : {} ;
}

sub _unverifiedFieldMap {
    my $self = shift;

    my %map = (
        'original_tab' => {
            subtotal           => 'A',
            unusedIsbn         => 'K',
            status             => 'T',
            publisherNetCredit => 'P', # PublisherCredit
            _user              => 'C',
            _name              => 'D',
        },
        'alternate_tab1' => {
            subtotal           => 'A',
            status             => 'V',
            publisherNetCredit => 'Q', # PublisherCredit
        },
    );

    return $self->{_tab_pattern} ? $map{ $self->{_tab_pattern} } : {} ;
}

sub rServiceName { 'RedShelf' }

1;
