package boundary;

import control.*;
import entity.*;

public class ECE567 {
	public static String UC6 = "1";
	public static String QUIT = "2";
	public static String SYSTEM_MENU = "System Menu";
	public static String ONLY_QUIT = "Only Quit";
	
	public static UC1Controller uc1Controller;
	public static SUDTimer timer;
	
	public ECE567() {
		timer = new SUDTimer();
		uc1Controller = new UC1Controller(timer);
	}
	
	public void runOnce() {
		SystemMenu.printMainMenu();
		handle(SYSTEM_MENU, SystemMenu.getUserInput());
		this.runAlways();
	}
	
	public void runAlways() {
		while (true) {
			handle(ONLY_QUIT, SystemMenu.getUserInput());
		}
	}
	
	public void handle(String whichMenu, String input) {
		if (whichMenu.equals(SYSTEM_MENU)) {
			if (input.equals(UC6)) {
				UC6Controller.uc6();
			}
			else if (input.equals(QUIT)) {
				System.out.println("Quitting...");
				System.exit(1);
			}
			else {
				System.err.println(input + ": Invalid input. Please try again.");
			}
		}
		else if (whichMenu.equals(ONLY_QUIT)) {
			if (input.equals(QUIT)) {
				System.out.println("Quitting...");
				System.exit(1);
			}
			else {
				System.err.println(input + ": Invalid input. Please try again.");
			}
		}
	}
	public static void main(String[] args) {
		ECE567 ece567 = new ECE567();
		ece567.runOnce();
	}
}
