package MpmasProducerOrganizationMILPSet;

use strict;
use warnings;
use Exporter;
use Storable qw(dclone);
use Data::Dumper;
use SimpleObjectRegistry;
use MpmasInputBlock;
use SimpleObject;
use IndexedTable;
use MpmasProducerOrganizationMILP;

our @ISA = qw(MpmasInputfileSet);


sub class_of_files{
	return "MpmasProducerOrganizationMILP";
 }
 sub filename {
	return "ProducerOrganizationMILPSet";
}
sub required {
	return	($_[0]->config_entry("PRODUCER_ORGS") > 0);
}
sub determine_files {
	my $self = shift;
	my $prodtab = $self->get_global("PRODUCER_ORGANIZATIONS");
	my $i = 0;
	for my $po (sort {$a <=> $b } $prodtab->query([],0) ) {
		$self->add_file($po, "3".$i++);
	}
}

sub prepare_shared_files {
	my ($self) = @_;
	for my $f ($self->files) {
		$f->prepare_shared();
	}
}

sub prepare_special_files {
	my $self = shift;
	for my $f ($self->files) {
		$self->delete_file($f) unless $f->prepare_special();
	}
}

1;
