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

use strict;
use warnings;

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

use lib '/app/tools/rps/lib';
use RPS::DB::Item::Payor;
use RPS::Payor::Payor;
use RPS::Alert;

use Common::FormObject;
use base 'Common::FormObject';

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

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

    $self->{Alert} = RPS::Alert->GetCurrentAlert();

    my $payorDB = RPS::DB::Item::Payor->GetDefault();
    if ($payorDB) {
        my $payor = RPS::Payor::Payor->new( _dbItem => $payorDB );
        if ( $payor->LogoSourceWeb ) {
            $self->{LogoSourceWeb} = $payor->LogoSourceWeb;
        }
    }

    return $self;
}

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

    if ( $propertyName eq 'Alert' ) {
        return 1;
    }

    return 0;
}

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

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

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

    $self->{Alert}->delete();
}

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

    return $self->{Alert}->validate();
}

###
1;    #
###
