package de.cinovo.cloudconductor.api.interfaces;

import java.util.Map;
import java.util.Set;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import de.cinovo.cloudconductor.api.IRestPath;
import de.cinovo.cloudconductor.api.MediaType;
import de.cinovo.cloudconductor.api.model.Package;
import de.cinovo.cloudconductor.api.model.PackageVersion;

/**
 * Copyright 2017 Cinovo AG<br>
 * <br>
 *
 * @author psigloch
 */
@Path(IRestPath.PKG)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface IPackage {
	
	/**
	 * @return set of packages
	 */
	@GET
	Set<Package> get();
	
	/**
	 * @param pkgName the name of the package
	 * @return the package
	 */
	@GET
	@Path(IRestPath.PKG_DETAIL)
	Package get(@PathParam(IRestPath.VAR_PKG) String pkgName);
	
	/**
	 * Get the existing package versions of a package
	 *
	 * @param pkgname the package name
	 * @return collection of package versions
	 */
	@GET
	@Path(IRestPath.PKG_VERSION)
	Set<PackageVersion> getVersions(@PathParam(IRestPath.VAR_PKG) String pkgname);
	
	/**
	 * @param pkgname the package name
	 * @return map of template-packageVersion pairs
	 */
	@GET
	@Path(IRestPath.PKG_USAGE)
	Map<String, String> getUsage(@PathParam(IRestPath.VAR_PKG) String pkgname);
	
	/**
	 * Get the existing package versions of a repo
	 *
	 * @param repoName the repo name
	 * @return collection of package versions
	 */
	@GET
	@Path(IRestPath.PKG_VERSION_REPO)
	Set<PackageVersion> getVersionsForRepo(@PathParam(IRestPath.VAR_REPO) String repoName);
}

@@ -117,16 +117,49 @@
 nsumes;%0A
+import javax.ws.rs.DefaultValue;%0A
 import j
@@ -253,24 +253,155 @@
 rs.Produces;
+%0Aimport javax.ws.rs.QueryParam;%0Aimport javax.ws.rs.core.Context;%0Aimport javax.ws.rs.core.Response;%0Aimport javax.ws.rs.core.UriInfo;
 %0A%0Aimport de.
@@ -806,60 +806,341 @@
  * @
-return set of packages%0A%09 */%0A%09@GET%0A%09Set%3CPackage%3E get(
+param page the number of the page%0A%09 * @param pageSize the number of packages per page%0A%09 * @param uriInfo the uri info%0A%09 * @return response including page of packages%0A%09 */%0A%09@GET%0A%09Response get(@DefaultValue(%220%22) @QueryParam(%22page%22) int page, //%0A%09%09%09@DefaultValue(%220%22) @QueryParam(%22per_page%22) int pageSize, //%0A%09%09%09@Context UriInfo uriInfo
 );%0A%09

Extend REST interface for packages to enable pagination.