// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Dependency.java
// public class Dependency {
//     private Scope scope;
//     private String groupId;
//     private String artifactId;
//     private String version;
//     
//     public enum Scope {
//         PROVIDED, COMPILE, RUNTIME;
//     }
// 
//     @ApiModelProperty(required = true)
//     public Scope getScope() {
//         return scope;
//     }
// 
//     public void setScope(Scope scope) {
//         this.scope = scope;
//     }
// 
//     @ApiModelProperty(required = false)
//     public String getGroupId() {
//         return groupId;
//     }
// 
//     public void setGroupId(String groupId) {
//         this.groupId = groupId;
//     }
// 
//     @ApiModelProperty(required = true)
//     public String getArtifactId() {
//         return artifactId;
//     }
// 
//     public void setArtifactId(String artifactId) {
//         this.artifactId = artifactId;
//     }
// 
//     @ApiModelProperty(required = true)
//     public String getVersion() {
//         return version;
//     }
// 
//     public void setVersion(String version) {
//         this.version = version;
//     }
//     
//     
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Dependency.java
// public enum Scope {
//     PROVIDED, COMPILE, RUNTIME;
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Location.java
// public class Location {
// 	private String path;
// 	private String url;
// 	
// 	public Location(String path, String url) {
// 		this.path = path;
// 		this.url = url;
// 	}
// 	
// 	public Location(String url) {
// 		this.url = url;
// 	}
// 	
// 	public Location() {
// 		//JSON serialisation
// 	}
// 	
// 	@ApiModelProperty(value="Relative path to insert the file within the sample project structure", required=false)
// 	public String getPath() {
// 		return path;
// 	}
// 	public void setPath(String path) {
// 		this.path = path;
// 	}
// 	
// 	@ApiModelProperty(value="URL to retrieve the file from", required=true)
// 	public String getUrl() {
// 		return url;
// 	}
// 	public void setUrl(String url) {
// 		this.url = url;
// 	}
// 	
// 	
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Provider.java
// public class Provider {
//     private String description;
//     private Dependency[] dependencies;
//     private Location repoUrl;
// 
//     @ApiModelProperty(value = "Description of the technology provider to be inserted into index.html", required = true)
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     @ApiModelProperty(value = "Dependencies to be specified to the user when they get the download", required = true)
//     public Dependency[] getDependencies() {
//         return dependencies;
//     }
// 
//     public void setDependencies(Dependency[] dependencies) {
//         this.dependencies = dependencies;
//     }
// 
//     @ApiModelProperty(value = "The location of the repository for this microservice.")
//     public Location getRepoUrl() {
//         return repoUrl;
//     }
// 
//     public void setRepoUrl(Location repoUrl) {
//         this.repoUrl = repoUrl;
//     }
// 
// }


import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.io.FileUtils;
import com.ibm.liberty.starter.api.v1.model.provider.Dependency;
import com.ibm.liberty.starter.api.v1.model.provider.Dependency.Scope;
import com.ibm.liberty.starter.api.v1.model.provider.Location;
import com.ibm.liberty.starter.api.v1.model.provider.Provider;
        compileDependency.setScope(Scope.COMPILE);
        compileDependency.setGroupId("net.wasdev.wlp.starters.test");
        compileDependency.setArtifactId("compile-pom");
        compileDependency.setVersion("0.0.1");
     
        Dependency[] dependencies = {providedDependency, runtimeDependency, compileDependency};
        details.setDependencies(dependencies);
    	return details;
    }
    
    //read the description contained in the index.html file
    private String getStringResource(String path) {
    	InputStream in = getClass().getResourceAsStream(path);
    	
    	StringBuilder index = new StringBuilder();
    	char[] buffer = new char[1024];
    	int read = 0;
    	try(InputStreamReader reader = new InputStreamReader(in)){
    		while((read = reader.read(buffer)) != -1) {
    			index.append(buffer, 0, read);
    		}
    	} catch (IOException e) {
    		//just return what we've got
    		return index.toString();
    	}
    	return index.toString();
    }

    @GET
    @Path("samples")
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Dependency.java
// public class Dependency {
//     private Scope scope;
//     private String groupId;
//     private String artifactId;
//     private String version;
//     
//     public enum Scope {
//         PROVIDED, COMPILE, RUNTIME;
//     }
// 
//     @ApiModelProperty(required = true)
//     public Scope getScope() {
//         return scope;
//     }
// 
//     public void setScope(Scope scope) {
//         this.scope = scope;
//     }
// 
//     @ApiModelProperty(required = false)
//     public String getGroupId() {
//         return groupId;
//     }
// 
//     public void setGroupId(String groupId) {
//         this.groupId = groupId;
//     }
// 
//     @ApiModelProperty(required = true)
//     public String getArtifactId() {
//         return artifactId;
//     }
// 
//     public void setArtifactId(String artifactId) {
//         this.artifactId = artifactId;
//     }
// 
//     @ApiModelProperty(required = true)
//     public String getVersion() {
//         return version;
//     }
// 
//     public void setVersion(String version) {
//         this.version = version;
//     }
//     
//     
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Dependency.java
// public enum Scope {
//     PROVIDED, COMPILE, RUNTIME;
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Location.java
// public class Location {
// 	private String path;
// 	private String url;
// 	
// 	public Location(String path, String url) {
// 		this.path = path;
// 		this.url = url;
// 	}
// 	
// 	public Location(String url) {
// 		this.url = url;
// 	}
// 	
// 	public Location() {
// 		//JSON serialisation
// 	}
// 	
// 	@ApiModelProperty(value="Relative path to insert the file within the sample project structure", required=false)
// 	public String getPath() {
// 		return path;
// 	}
// 	public void setPath(String path) {
// 		this.path = path;
// 	}
// 	
// 	@ApiModelProperty(value="URL to retrieve the file from", required=true)
// 	public String getUrl() {
// 		return url;
// 	}
// 	public void setUrl(String url) {
// 		this.url = url;
// 	}
// 	
// 	
// }
// 
// Path: liberty-starter-model/src/main/java/com/ibm/liberty/starter/api/v1/model/provider/Provider.java
// public class Provider {
//     private String description;
//     private Dependency[] dependencies;
//     private Location repoUrl;
// 
//     @ApiModelProperty(value = "Description of the technology provider to be inserted into index.html", required = true)
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     @ApiModelProperty(value = "Dependencies to be specified to the user when they get the download", required = true)
//     public Dependency[] getDependencies() {
//         return dependencies;
//     }
// 
//     public void setDependencies(Dependency[] dependencies) {
//         this.dependencies = dependencies;
//     }
// 
//     @ApiModelProperty(value = "The location of the repository for this microservice.")
//     public Location getRepoUrl() {
//         return repoUrl;
//     }
// 
//     public void setRepoUrl(Location repoUrl) {
//         this.repoUrl = repoUrl;
//     }
// 
// }


// Path: starter-microservice-test/src/main/java/com/ibm/liberty/starter/service/test/api/v1/ProviderEndpoint.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.io.FileUtils;
import com.ibm.liberty.starter.api.v1.model.provider.Dependency;
import com.ibm.liberty.starter.api.v1.model.provider.Dependency.Scope;
import com.ibm.liberty.starter.api.v1.model.provider.Location;
import com.ibm.liberty.starter.api.v1.model.provider.Provider;

        compileDependency.setScope(Scope.COMPILE);
        compileDependency.setGroupId("net.wasdev.wlp.starters.test");
        compileDependency.setArtifactId("compile-pom");
        compileDependency.setVersion("0.0.1");
     
        Dependency[] dependencies = {providedDependency, runtimeDependency, compileDependency};
        details.setDependencies(dependencies);
    	return details;
    }
    
    //read the description contained in the index.html file
    private String getStringResource(String path) {
    	InputStream in = getClass().getResourceAsStream(path);
    	
    	StringBuilder index = new StringBuilder();
    	char[] buffer = new char[1024];
    	int read = 0;
    	try(InputStreamReader reader = new InputStreamReader(in)){
    		while((read = reader.read(buffer)) != -1) {
    			index.append(buffer, 0, read);
    		}
    	} catch (IOException e) {
    		//just return what we've got
    		return index.toString();
    	}
    	return index.toString();
    }

    @GET
    @Path("samples")
    @Produces(MediaType.APPLICATION_JSON)