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

use lib '/app/tools/common/lib';
use Common::Assert;
use lib '/app/tools/bookpub/lib';
use BookPub::DB::Item::WatchList;
use BookPub::Market::WatchList;

use base 'Common::FormObject::List';

sub _itemName { return 'WatchList'; }

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

    # Right now, we only have a need for all simple lists or all lists.
    # We can add an all dynamic later if we need to.
    #
    my $type = $args{type};

    if ( $type && $type eq 'simple' ) {
        return BookPub::DB::Item::WatchList->GetAllSimpleSortedByName();
    } else {
        return BookPub::DB::Item::WatchList->GetAllSortedByName();
    }
}

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

    return BookPub::Market::WatchList->new( dbItem => $dbItem, readOnly => 1 );
}

1;
