#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Catalog::RecentlyViewedBookList;

use strict;
use warnings;

use lib '/app/tools/bookpub/lib';
use BookPub::DB::Item::Book;
use BookPub::Catalog::Book::WithAuthor::WithProductCount;

use Common::FormObject;
use Common::CommandLog;
use base 'Common::CommandLog';

sub _createLogItemFromDBItem {
    my ( $self, $dbItem ) = @_;

    # First call the inherited method to get the log item
    #
    my $logItem = $self->SUPER::_createLogItemFromDBItem($dbItem);

    # Now we can stuff the Book inside the log item
    #
    my $bookObj = BookPub::Catalog::Book::WithAuthor::WithProductCount->new( bookID => $logItem->CommandID() );
    $logItem->{Book} = $bookObj;

    return $logItem;
}

sub _init {
    my ( $self, %args ) = @_;

    $args{command}     = ['BookPub::Catalog::Command::ShowBook'];
    $args{most_recent} = 1;

    return $self->SUPER::_init(%args);

}

1;

