package BookPub::Import::Importer::Kobo::Version3;

use strict;

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

sub _isAgency { return 'Y'; }

# essentially the same as v2 but all tabs have the same layout, except refunds
my %_fieldMap = (
    sales => {
        date    => 0,
        country => 1,

        #state       => 2,
        #zip         => 3,
        units     => 4,
        isbn13    => 5,
        author    => 6,
        title     => 7,
        listPrice => 8,
        discount  => 9,
        revenue   => 10,
        currency  => 11,

        #taxRate     => 12,
        #taxAmt      => 13,
        #city        => 14,
        #county      => 15,
    },
    refunds => {
        date      => 0,
        country   => 2,
        isbn13    => 5,
        author    => 6,
        title     => 7,
        listPrice => 8,
        discount  => 9,
        revenue   => 12,
        currency  => 13,
        reason    => 14,
    }
);

sub _getFieldMap {
    my ( $self, $dataRow, $sheetName ) = @_;

    return $sheetName =~ m/^refund/i ? $_fieldMap{refunds} : $_fieldMap{sales};
}

1;
