package BookPub::Import::Importer::WGU;

use strict;

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

sub _fieldMap {
    {
        rTitle   => 'B',
        rIsbn13  => 'F',
        rRevenue => 'G',
    };
}

sub _unverifiedFieldMap {
    {
        accessDate => 'D',
        passDate   => 'E',
    };
}

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

sub _useIsSaleRec              { 1 }
sub _autoParseTitleAndSubtitle { 1 }

sub countryCode  { 'US' }
sub currencyCode { 'USD' }
sub productType  { BookPub::DB::Item::Sale::kProductTypeEBook }
sub priceType    { 'rrp' }
sub purchaseType { BookPub::DB::Item::Sale::kPurchaseTypeSubscriptionDL }
sub rInstitution { 'WGU' }
sub state        { 'UT' }
sub postalCode   { '84107' }

#sub _dateNormalization { 'month' }
sub _getDateBegin {
    my $self = shift;

    return $self->_getByFieldName('passDate') || $self->_getByFieldName('accessDate');
}

sub units {
    return shift->rRevenue < 0 ? -1 : 1;
}

1;

