package com.careerhub.go.plugin;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;

import com.careerhub.go.plugin.util.JSONUtils;

public class NotificationService {

	
	public Map<String, Object> getNotificationsInterestedIn() {
        Map<String, Object> response = new HashMap<String, Object>();
        response.put("notifications", Arrays.asList(Constants.REQUEST_STAGE_STATUS));
		return response;
	}
	
	public int sendNotification(PluginSettings settings, Map<String, Object> info) throws ClientProtocolException, IOException {
        String callbackUrl = settings.getCallbackUrl();
        
        HttpClient httpClient = HttpClientBuilder.create().build();
        HttpPost request = new HttpPost(callbackUrl);  
        
        String json = JSONUtils.toJSON(info);
    	    	
    	StringEntity jsonEntity =new StringEntity(json);
     
    	request.setEntity(jsonEntity);
        
    	HttpResponse response = httpClient.execute(request);        
        
    	int statusCode = response.getStatusLine().getStatusCode();

    	return statusCode;
	}
}

@@ -1251,24 +1251,196 @@
 Url);  %0A
-        
+%0A%09%09request.setHeader(%22Content-Type%22, %22application/json%22);%0A%0A%09%09// Could process json and parse processed json on%0A%09%09// However, at this stage their is no need%0A%09%09// Just pass on as is.
 %0A       
@@ -1519,16 +1519,17 @@
 Entity =
+ 
 new Stri

Fix notification content type