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

use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::DB::Item::LicenseIncomeType;
use RPS::LicenseIncome::LicenseIncomeType;

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->{LicenseIncomeType} = [];
    my $licenseIncomeCollection = RPS::DB::Item::LicenseIncomeType->Search(
        searchTerm => $args{query},
        limit      => $args{limit},
        contractID => $args{contractID},
        albumID    => $args{albumID},
        trackID    => $args{trackID}
    );

    while ( $licenseIncomeCollection->hasNext() ) {
        my $licenseIncomeObj = $licenseIncomeCollection->next();
        push @{ $self->{LicenseIncomeType} }, RPS::LicenseIncome::LicenseIncomeType->new( _dbItem => $licenseIncomeObj );
    }

    return $self;
}

1;
