package fr.laas.gctrl;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public class GctrlApplication {

	static int x = 0;
    static int  y = 0;
    static int p = 2000;
    
	public static void main(String[] args) throws ClientProtocolException, IOException, InterruptedException{
		while(true){
		String[] workflow = {"UC1","UC2","UC3"};
		for (String w : workflow) {
            switch (w) {
			    case "UC1":
			    	if(x==0){
			    	x=1;
			    	System.out.println("Okay1 "+x);}
			        break;
			    case "UC2":
			    	if(y==0){
			    	y=1;
			    	System.out.println("Okay2 "+y);p=5000;}
			        break;
			    case "UC3":
			    	System.out.println("Okay3");
			        break;
			}
		}
		Thread.sleep(p);
        continue;
		
	}
	}

}
