// Path: src/main/java/edu/sjsu/mithai/export/HttpExportMessage.java
// public class HttpExportMessage extends ExportMessage {
// 
//     private String uri;
// 
//     public HttpExportMessage(String message, String uri) {
//         super(message);
//         this.uri = uri;
//     }
// 
//     public String getUri() {
//         return uri;
//     }
// 
//     @Override
//     public String toString() {
//         return "HttpExportMessage{" +
//                 "uri='" + uri + '\'' +
//                 "message=" + message + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/Ihandler.java
// public interface Ihandler {
// 
//     void handle(String functionName, String msg);
// }


import com.google.gson.Gson;
import edu.sjsu.mithai.export.HttpExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.LinkedHashMap;
import java.util.Map;
package edu.sjsu.mithai.apps.parkinglot;



public class ParkingResponseHandler implements Ihandler {

    private Gson gson;
    private Map<String, Integer> parkingStatus;

    public ParkingResponseHandler() {
        this.gson = new Gson();
        this.parkingStatus = new LinkedHashMap<>();
    }

    @Override
    public void handle(String functionName, String msg) {

        if (functionName.equals("ShortestPath")) {

            for (String key : ParkingApplication.parkingSensorMap.keySet()) {
                int status = ParkingApplication.parkingSensorMap.get(key).isParked() ? 1 : 0;
                parkingStatus.put(key, status);
            }
            System.out.println(functionName + "=>" + msg);

// Path: src/main/java/edu/sjsu/mithai/export/HttpExportMessage.java
// public class HttpExportMessage extends ExportMessage {
// 
//     private String uri;
// 
//     public HttpExportMessage(String message, String uri) {
//         super(message);
//         this.uri = uri;
//     }
// 
//     public String getUri() {
//         return uri;
//     }
// 
//     @Override
//     public String toString() {
//         return "HttpExportMessage{" +
//                 "uri='" + uri + '\'' +
//                 "message=" + message + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/Ihandler.java
// public interface Ihandler {
// 
//     void handle(String functionName, String msg);
// }


// Path: src/main/java/edu/sjsu/mithai/apps/parkinglot/ParkingResponseHandler.java
import com.google.gson.Gson;
import edu.sjsu.mithai.export.HttpExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.LinkedHashMap;
import java.util.Map;

package edu.sjsu.mithai.apps.parkinglot;



public class ParkingResponseHandler implements Ihandler {

    private Gson gson;
    private Map<String, Integer> parkingStatus;

    public ParkingResponseHandler() {
        this.gson = new Gson();
        this.parkingStatus = new LinkedHashMap<>();
    }

    @Override
    public void handle(String functionName, String msg) {

        if (functionName.equals("ShortestPath")) {

            for (String key : ParkingApplication.parkingSensorMap.keySet()) {
                int status = ParkingApplication.parkingSensorMap.get(key).isParked() ? 1 : 0;
                parkingStatus.put(key, status);
            }
            System.out.println(functionName + "=>" + msg);

            HttpExportMessage message = new HttpExportMessage(gson.toJson(parkingStatus),