<?php
	require "vendor/autoload.php";
	include_once("config.inc.php");
	include_once("init.php");
	
	if(isset($_POST["task"]) && isset($_POST["action"])){
		$task = $_POST["task"];
		$action = $_POST["action"];
	}else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate"){
		$task = $_POST["task"];
	}else{
		//Gestion Erreur
	}
	
	if($task == "Authenticate"){
		
		$App->authenticate();
		$App->show();
		
	}
	
	switch($task)
	{
		case "identity":
			include_once("core/Identity.php");
			$identityObject = new identity($App);
			$identityObject->action($action);
			$App->show();
			break;
		
		case "network":
                        include_once("core/Network.php");
                        $networkObject = new network($App);
                        $networkObject->action($action);
                        $App->show();
                        break;	
		
		case "image":
			include_once("core/Image.php");
			$imageObject = new image($App);
			$imageObject->action($action);
			$App->show();
			break;

		case "compute":
			include_once("core/Compute.php");
			$computeObject = new compute($App);
			$computeObject->action($action);
			$App->show();
			break;
	}