-- Selection Manager
-- load the static definitions
dofile("Scripts/selectionDefines.lua");

SelectionManager = nil;
SelectionManager = {};
SelectionManager.__index = SelectionManager;

function SelectionManager.create()
	local mgr = {}
	setmetatable(mgr, SelectionManager)
	mgr.selections = {};

	return mgr;
end

function SelectionManager:SetSelection(venueType, drinkType, musicType)
	venue_entry = {}
	drink_entry = {}
	music_entry = {}
	
	-- Lua has a base array value of 1, not 0 (types are C style enum)
	self.selections[SelectionType.VENUE+1] = {}
	self.selections[SelectionType.DRINK+1] = {}
	self.selections[SelectionType.MUSIC+1] = {}

	venue_entry = VenueEntries[venueType+1];
	drink_entry = DrinkEntries[drinkType+1];
	music_entry = MusicEntries[musicType+1];

	self.selections[SelectionType.VENUE+1] = venue_entry
	self.selections[SelectionType.DRINK+1] = drink_entry
	self.selections[SelectionType.MUSIC+1] = music_entry

	--TraceToLog("<<<<<<<<SetSelection: ");
	--TraceToLog(string.format("MusicEntries = %d", table.getn(MusicEntries)));
	--TraceToLog(string.format("music_entry = %d", table.getn(music_entry)));

end

function SelectionManager:GenerateSelection()
	selection_list = {};

	-- Add Core Data
	table.insert(selection_list, self.selections[SelectionType.VENUE+1]);
	table.insert(selection_list, self.selections[SelectionType.DRINK+1]);
	table.insert(selection_list, self.selections[SelectionType.MUSIC+1]);

	--TraceToLog("<<<<<<<<GenerateSelection: ");
	--TraceToLog(string.format("selection_list = %d", table.getn(selection_list)));

	-- Return the new list
	return selection_list;
end

TraceToLog("<<<<<<<<SelectionManager: PAGE LOADED!");
