#------------------------------------------------------------
# Copyright (C) 2007 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
#
#------------------------------------------------------------
# Validation Album Common Object.  Extends the Validate
# Rule class.  This object contains the method to do
# validation on piece of data.
#
# Test the target field to ensure all rows contain the same
# data.
#
# Base Class:
#   Validation::Rule
#
# Public methods:
#   + Metadata::Rule::Album::Common new();
#   + $fail_status         ok();
#   + $scalar              AUTOLOAD( $scalar );
#------------------------------------------------------------
package Metadata::Rule::CurrentData::Track;
use strict;

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

use lib '/app/tools/metadata/lib';
use base 'Metadata::Rule::CurrentData';

use vars qw($AUTOLOAD);

###
# Default failure message if the OK method fails.
###
use constant kFailureMessage => "Track already exists in the current data";

use constant kClassAttributes => qw();

#------------------------------------------------------------
# Public Methods
#------------------------------------------------------------

#------------------------------------------------------------
# Constructor
#------------------------------------------------------------
sub new {
    my ( $class, %args ) = @_;
    my $self = bless {}, $class;

    return $self->_init(%args);
}

#------------------------------------------------------------
# Private Methods
#------------------------------------------------------------

#------------------------------------------------------------
# Validate::Rule _init()
# Initialize the object.
#
# - Build accessor method hash
# - set internal private data ( message, fail_status, and
#   parameter ). See the base class for parameter defintions.
#------------------------------------------------------------
sub _init {
    my ( $self, %args ) = @_;

    # Build a hash with our valid class attributes
    foreach ( (kClassAttributes) ) {
        $self->{_attributes}->{$_}++;
    }

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

    $self->message( $args{message} ? $args{message} : kFailureMessage );

    return $self;
}

1;
