#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package Support::Reports::Command::AlbumCount;
use strict;
use warnings;

use lib '/app/tools/support/lib';
use Support::Reports::AlbumCount;

use base 'Support::Command::Submit';

use lib '/app/tools/common/lib';
use RSApache::Response::XSLT;

use lib '/app/tools/distribution/lib';

sub cmd  { return 'album_count'; }
sub area { return 'reports'; }

use constant kTemplate => "/app/tools/support/templates/reports/album_count.xsl";

sub execute {
    my ($self) = @_;

    my $response = $self->SUPER::execute();
    return $response if $response;

    my $client     = $self->getParam('client');
    my $clientType = $self->getParam('clientType');
    my $status     = $self->getParam('status');

    my $report = new Support::Reports::AlbumCount(
        clientID     => $client,
        clientTypeID => $clientType
    );

    $report->run( status => $status ) if ( $self->isSubmit() );

    $self->{xml}{Collection} = $report;

    $response = RSApache::Response::XSLT->new( $self->{xml}, kTemplate );
    return $response;
}

1;
