package APE::BarcodeFactory::ConcreteBarcode::TractColumnBarcode;

use base 'APE::BarcodeFactory::ConcreteBarcode::Barcode';

use strict;
use warnings;
use Carp;

use constant TRUE  => 1;
use constant FALSE => 0;

{
    my %_attributes = ();
    
    my %object; 
    
    
    foreach my $attName (keys(%_attributes)) {
	no strict 'refs';
	*{__PACKAGE__ . "::get\u$attName"} = sub { $object{ $_[0] }->{$attName} }
    }
    
    
    #################################################################
    ## Initialise the objects private attributes. The argument is
    ## deleted as it is found, initialised and set.
    #################################################################
    sub _init {	
	my ($self,%args) = @_;
	foreach my $attName (keys(%args)) {
	    if(exists($_attributes{$attName})) { 
		$object{ $self }->{$attName} = delete $args{$attName};
	    }
	}   
	return $self->SUPER::_init(%args);
    }


    #################################################################
    ## Implemented abstract method from the super class. This method 
    ## creates and returns the actual description - this is what it's
    ## all about.
    #################################################################
    sub createBarcode {
	my $self = shift;
	my $flushController = $self->getFlushController;
	my $newEntityId     = $self->getEntityId;#$flushController->getNewEntityId;
	my $barcodeType     = $self->getBarcodeType;
	my $reservedData    = $self->getReservedData;
	my $oligoNames      = $reservedData->[0];#$flushController->getOligoNames;
	my $name            = $reservedData->[1];#$flushController->getEpName;
	my $columnNumber    = $reservedData->[2];#$flushController->getColumnNumber;
	return {Prefix  => $barcodeType,
		Barcode => $newEntityId,
		Name    => $oligoNames,
		Project => "48x8-$columnNumber $name"};
    }
}

1;
