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

use strict;
use warnings;
use lib '/app/tools/common/lib';
use Common::Assert;

use lib '/app/tools/bookpub/lib';
use BookPub::Market::WatchList;

use base 'Common::FormObject';

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

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

    my $watchList;
    if ( $args{watchListID} ) {
        $watchList = BookPub::Market::WatchList->new( watchListID => $args{watchListID} );
    } else {
        $watchList = BookPub::Market::WatchList->new();
    }
    $self->{WatchList} = $watchList;

    return $self;
}

sub _propertyIsEditable {
    my ( $self, $propertyName ) = @_;

    # The Watch List (and contained objects) can be edited.

    return 1 if ( $propertyName eq 'WatchList' );
    return 0;
}

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

    return $self->{WatchList}->validate(%args);
}

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

    $self->{WatchList}->save();
}

###
1;    #
###
