#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package BookPub::Matcher::Product;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use RSApache::Message;
use base 'Common::FormObject';

use lib '/app/tools/bookpub/lib';
use BookPub::DB::Item::Product;
use BookPub::DB::Item::ProductType;
use BookPub::Matcher::Product::Book;

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

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

    # Basically, I'm going to cheat.
    #

    my $productID = $args{productID};
    my $dbItem = BookPub::DB::Item::Product->Lookup( product_id => $productID );
    if ( BookPub::DB::Item::ProductType::kBook == $dbItem->product_type_id ) {
        return BookPub::Matcher::Product::Book->new( productID => $productID );
    } else {
        die "not supported yet";
    }
}

1;
