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

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

use lib '/app/tools/rps/lib';
use RPS::ControlledComposition::ControlledComposition;
use RPS::ArtistContract::ArtistContract;
use RPS::Payor::PayorList;
use RPS::RoyaltyRun::RoyaltyRunStatusList;

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

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

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

    my $ccompID = $args{ccompID};
    $self->{ControlledComposition} = RPS::ControlledComposition::ControlledComposition->new( controlledCompositionID => $ccompID );

    my $contractID = $args{contractID} || $self->{ControlledComposition}->ArtistContractID();
    $self->{ArtistContract} = RPS::ArtistContract::ArtistContract->new( artistContractID => $contractID, loadSubs => 0 );

    $self->{PayorList} = RPS::Payor::PayorList->new();

    $self->{RoyaltyRunStatus} = new RPS::RoyaltyRun::RoyaltyRunStatusList( usMechanical => 1, caMechanical => 1 );

    return $self;
}

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

    return $self->{ControlledComposition}->ControlledCompositionID();
}

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

    return $self->{ControlledComposition}->ArtistContractID();
}

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

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

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

    my $valid = $self->{ControlledComposition}->validate();
    return $valid;
}

###
1;    #
###
