// Path: src/main/java/com/nickdsantos/onedrive4j/Resource.java
// public enum SharedWith {
// 	Selected("People I selected"), 
// 	JustMe("Just me"), 
// 	Everyone("Everyone (public)"), 
// 	Friends("Friends"), 
// 	FriendsOfFriends("My friends and their friends"), 
// 	PeopleWithLink("People with a link");
// 		
// 	private final String _val;
// 	private SharedWith(String val) {
// 		_val = val;			
// 	}
// 		
// 	@Override
// 	public String toString() {
// 		return _val;			
// 	}
// 		
// 	public static SharedWith parse(String value) throws Exception {
// 		switch (value.toLowerCase()) {
// 			case "people i selected":
// 				return SharedWith.Selected;
// 			case "just me":
// 				return SharedWith.JustMe;
// 			case "everyone (public)":
// 				return SharedWith.Everyone;
// 			case "friends":
// 				return SharedWith.Friends;
// 			case "my friends and their friends":
// 				return SharedWith.FriendsOfFriends;
// 			case "people with a link":
// 				return SharedWith.PeopleWithLink;
// 			default:
// 				throw new Exception("Unsupported value: " + value);
// 		}
// 	}
// }


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.nickdsantos.onedrive4j.Resource.SharedWith;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.*;
		}

		try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
			HttpDelete httpDelete = new HttpDelete(uri);
			Map<Object, Object> rawResponse = httpClient.execute(httpDelete, new OneDriveJsonToMapResponseHandler());
			if (rawResponse != null) {
				System.out.println(rawResponse);
			}
		}
	}
	
	private Photo createPhotoFromMap(Map<Object, Object> responseMap) {
		if (logger.isDebugEnabled()) {
			for (Object k : responseMap.keySet()) {
				logger.debug(k + " : " + responseMap.get(k));
			}
		}
		
		SimpleDateFormat dtFormat = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ssZ");	
		Photo photo = null;
		if (responseMap.get("type").equals("photo")) {
			try {
				// Get embedded from JSON
				Map<String, String> fromUserMap = (Map<String, String>) responseMap.get("from");
				User fromUser = new User();
				fromUser.setId(fromUserMap.get("id"));
				fromUser.setName(fromUserMap.get("name"));
				
				// Get embedded shared_with JSON
				Map<String, String> sharedWithMap = (Map<String, String>) responseMap.get("shared_with");
// Path: src/main/java/com/nickdsantos/onedrive4j/Resource.java
// public enum SharedWith {
// 	Selected("People I selected"), 
// 	JustMe("Just me"), 
// 	Everyone("Everyone (public)"), 
// 	Friends("Friends"), 
// 	FriendsOfFriends("My friends and their friends"), 
// 	PeopleWithLink("People with a link");
// 		
// 	private final String _val;
// 	private SharedWith(String val) {
// 		_val = val;			
// 	}
// 		
// 	@Override
// 	public String toString() {
// 		return _val;			
// 	}
// 		
// 	public static SharedWith parse(String value) throws Exception {
// 		switch (value.toLowerCase()) {
// 			case "people i selected":
// 				return SharedWith.Selected;
// 			case "just me":
// 				return SharedWith.JustMe;
// 			case "everyone (public)":
// 				return SharedWith.Everyone;
// 			case "friends":
// 				return SharedWith.Friends;
// 			case "my friends and their friends":
// 				return SharedWith.FriendsOfFriends;
// 			case "people with a link":
// 				return SharedWith.PeopleWithLink;
// 			default:
// 				throw new Exception("Unsupported value: " + value);
// 		}
// 	}
// }


// Path: src/main/java/com/nickdsantos/onedrive4j/PhotoService.java
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.nickdsantos.onedrive4j.Resource.SharedWith;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.*;

		}

		try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
			HttpDelete httpDelete = new HttpDelete(uri);
			Map<Object, Object> rawResponse = httpClient.execute(httpDelete, new OneDriveJsonToMapResponseHandler());
			if (rawResponse != null) {
				System.out.println(rawResponse);
			}
		}
	}
	
	private Photo createPhotoFromMap(Map<Object, Object> responseMap) {
		if (logger.isDebugEnabled()) {
			for (Object k : responseMap.keySet()) {
				logger.debug(k + " : " + responseMap.get(k));
			}
		}
		
		SimpleDateFormat dtFormat = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ssZ");	
		Photo photo = null;
		if (responseMap.get("type").equals("photo")) {
			try {
				// Get embedded from JSON
				Map<String, String> fromUserMap = (Map<String, String>) responseMap.get("from");
				User fromUser = new User();
				fromUser.setId(fromUserMap.get("id"));
				fromUser.setName(fromUserMap.get("name"));
				
				// Get embedded shared_with JSON
				Map<String, String> sharedWithMap = (Map<String, String>) responseMap.get("shared_with");
				SharedWith sharedWith = SharedWith.parse(sharedWithMap.get("access"));		