#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Catalog::ArtistList;

use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::DB::Item::Artist;
use RPS::Catalog::Artist;

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

# This is a read-only XMLObject, so we don't need any
# of the accessor methods, just create the list of
# items and be on your way.
#

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

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

    $self->{Artist} = [];

    #	my $artistCollection = RPS::DB::Item::Artist->GetAll();
    my $artistCollection = RPS::DB::Item::Artist->Search( searchTerm => $args{query}, limit => $args{limit} );

    while ( $artistCollection->hasNext() ) {
        my $artistObj = $artistCollection->next();
        push @{ $self->{Artist} }, RPS::Catalog::Artist->new( _dbItem => $artistObj );
    }

    return $self;
}

1;
