package bwyap.familyfeud.gui.window;

import java.util.HashMap;
import java.util.Map;

import bwyap.familyfeud.OSValidator;

/**
 * This class is responsible for handling UI settings to allow macOS and win10 compatibility.
 * This class is implemented as a singleton.
 * @author bwyap
 *
 */
public class UIManager {
	
	public enum SupportedOS {
		WINDOWS,
		MACOS;
	}
	
	private static UIManager manager;
	
	private Map<SupportedOS, Map<String, Integer>> dimensions;
	
	private Map<String, Integer> currentOSDimensions;
	
	/**
	 * Get the UI Manager instance.
	 * @return
	 */
	public static UIManager getInstance() {
		if (manager == null) {
			manager = new UIManager();
		}
		return manager;
	}
	
	private UIManager() {
		dimensions = new HashMap<SupportedOS, Map<String, Integer>>();
		loadMacOSDimensions();
		loadWindowsDimensions();
	}
	
	private void loadMacOSDimensions() {
		// TODO make this more dynamic
		Map<String, Integer> map = new HashMap<String, Integer>();
		
		
		
		dimensions.put(SupportedOS.MACOS, map);
	}
	
	private void loadWindowsDimensions() {
		// TODO make this more dynamic
		Map<String, Integer> map = new HashMap<String, Integer>();
		
		
		
		dimensions.put(SupportedOS.WINDOWS, map);
	}
	
	/**
	 * Get the dimension for the specified property for the current OS.
	 * @param propertyname
	 * @return
	 */
	public int getDimension(String propertyname) {
		if (currentOSDimensions == null) {
			if (OSValidator.isMac()) {
				currentOSDimensions = dimensions.get(SupportedOS.MACOS);
			}
			else if (OSValidator.isWindows()) {
				currentOSDimensions = dimensions.get(SupportedOS.WINDOWS);
			}
		}
		
		return currentOSDimensions.get(propertyname);
	}
	
}

@@ -968,32 +968,1587 @@
 nteger%3E();%0A%09%09%0A%09%09
+map.put(%22controlwindow.width%22, 800);%0A%09%09map.put(%22controlwindow.height%22, 640);%0A%09%09  %0A%09%09map.put(%22windowcontrolpanel.width%22, 180);%0A%09%09map.put(%22windowcontrolpanel.height%22, 120);%0A%09%09%0A%09%09map.put(%22statepanel.width%22, 180);%0A%09%09map.put(%22statepanel.height%22, 220);%0A%09%09  %0A%09%09map.put(%22consolepanel.width%22, map.get(%22controlwindow.width%22) - 10);%0A%09%09map.put(%22consolepanel.height%22, 200);%0A%09%09  %0A%09%09map.put(%22stateplaypanel.width%22, map.get(%22statepanel.width%22));%0A%09%09map.put(%22stateplaypanel.height%22, map.get(%22controlwindow.height%22) - map.get(%22consolepanel.height%22) - map.get(%22statepanel.height%22) - 25);%0A%09%09  %0A%09%09map.put(%22familypanel.width%22, map.get(%22windowcontrolpanel.width%22));%0A%09%09map.put(%22familypanel.height%22, map.get(%22stateplaypanel.height%22));%0A%09%09%0A%09%09map.put(%22managefamilypanel.width%22, map.get(%22statepanel.width%22));%0A%09%09map.put(%22managefamilypanel.height%22, map.get(%22statepanel.height%22) - map.get(%22windowcontrolpanel.height%22));%0A%09%09  %0A%09%09map.put(%22questionselectionpanel.width%22, map.get(%22controlwindow.width%22) - map.get(%22statepanel.width%22) - map.get(%22windowcontrolpanel.width%22) - 10);%0A%09%09map.put(%22questionselectionpanel.height%22, (int)(0.8 * map.get(%22statepanel.height%22)));%0A%09%09  %0A%09%09map.put(%22questionsetloaderpanel.width%22, map.get(%22controlwindow.width%22) - map.get(%22statepanel.width%22) - map.get(%22windowcontrolpanel.width%22) - 10);%0A%09%09map.put(%22questionsetloaderpanel.height%22, map.get(%22statepanel.height%22) - map.get(%22questionselectionpanel.height%22));%0A%0A%09%09map.put(%22questioncontrolpanel.width%22, map.get(%22questionselectionpanel.width%22));%0A%09%09map.put(%22questioncontrolpanel.height%22, map.get(%22stateplaypanel.height%22));
 %0A%09%09%0A%09%09dimensions

Add basic macOS dimension loading in UIManager