package BookPub::Admin::Command::SaleFeed;
use strict;

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

use lib '/app/tools/bookpub/lib';
use BookPub::Admin::SaleFeedServiceURLList;
use BookPub::Catalog::ServiceList;
use BookPub::Sale::Feed::SaleFeedServiceHash;

use base 'BookPub::Command';

use constant kTemplate => '/app/tools/bookpub/templates/admin/sale_feed.xsl';

sub cmd      { return 'sale_feed'; }
sub area     { return 'admin'; }
sub pageName { return 'Revenue Feed Management'; }

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

    # Give any inherited methods the first crack at this.
    # (This checks for login and basic access permissions).
    #
    my $response = $self->SUPER::execute();
    return $response if $response;

    $self->{xml}{SaleFeedServiceList}    = BookPub::Sale::Feed::SaleFeedServiceHash->new();
    $self->{xml}{ServiceList}            = BookPub::Catalog::ServiceList->new();
    $self->{xml}{SaleFeedServiceURLList} = BookPub::Admin::SaleFeedServiceURLList->new();

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

    return $response;
}

1;

