/*
 * Copyright 2015 The Mashub Project
 *
 * The Mashub Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.beatsbucket.mashub.webhook;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

@Path("things")
public class Things {
	
    /**
     * Method handling HTTP GET requests. The returned object will be sent
     * to the client as "text/plain" media type.
	 * @param serial
     * @return String that will be returned as a text/plain response.
     */
    @GET
    @Path("{serial}")
    @Produces(MediaType.TEXT_PLAIN)
    public String getIt(@PathParam("serial") String serial) {
        return "Got "+serial+"!";
    }
    
    /**
     * This interface is used to register things.
     * 
     * @param name - System name of the Thing (need not be unique).
     * @param default_display_name - Name of the Thing to be displayed to users. If a default display name is not provided, the system name is displayed.
     * @param proxy - Identification of the Thing client or proxy (many things can share the same proxy).
     * @param uuid - Manufacturer-provided serial number of the Thing.
     * @param manufacturer - Name of the Thing manufacturer.
     * @param model - Thing model.
     * @param protocol_version - Version of the protocol supported by the Thing, e.g. "1.0".
     * @param setup_url - URL with Thing setup instructions.
     * @param support_url - URL that user should be directed to if they are in need of Thing support.
     * @param update_url - URL that user should be directed to if Thing needs a firmware update.
     * @param firmware - Version of the Thing's firmware.
     * @param local_settings - Current local settings of the Thing (see Local settings).
     * @param semantic_state - Current state of the Thing.
     * @param capabilities - Thing capabilities.
     * @param capsHash - A hash or digest value of the capabilities data. This value is useful, for example, to compare values and check whether the local Thing's capabilities have changed.
     * @param tag - Tags (free-form string values) to add to the Thing. You can attach a set of unique tags to a Thing, which may be useful to store additional metadata about the Thing for later use by your application.
     * @param data - Private data to add to the Thing. Private data values are similar to tags except that they are write-only; they can be added in /register and added or removed in /update, but they are never rendered in responses from the server.
     * @return
     */
    @POST
    @Path("register")
    @Produces(MediaType.TEXT_PLAIN)
    public String register(@QueryParam("name") String name,
    		@QueryParam("default_display_name") String defaultDisplayName,
    		@QueryParam("proxy") String proxy,
    		@QueryParam("uuid") String uuid,
    		@QueryParam("manufacturer") String manufacturer,
    		@QueryParam("model") String model,
    		@QueryParam("protocol_version") String protocolVersion,
    		@QueryParam("setup_url") String setupUrl,
    		@QueryParam("support_url") String supportUrl,
    		@QueryParam("update_url") String updateUrl,
    		@QueryParam("firmware") String firmware,
    		@QueryParam("local_settings") String localSettings,
    		@QueryParam("semantic_state") String semanticState,
    		@QueryParam("capabilities") String capabilities,
    		@QueryParam("capsHash") String capsHash,
    		@QueryParam("tag") String tag,
    		@QueryParam("data") String data
    		) {
    	
        return "";
    }
    
}

@@ -1398,18 +1398,17 @@
 ram name
- -
+:
  System 
@@ -1481,18 +1481,17 @@
 lay_name
- -
+:
  Name of
@@ -1619,18 +1619,17 @@
 am proxy
- -
+:
  Identif
@@ -1723,18 +1723,17 @@
 ram uuid
- -
+:
  Manufac
@@ -1801,18 +1801,17 @@
 facturer
- -
+:
  Name of
@@ -1854,18 +1854,17 @@
 am model
- -
+:
  Thing m
@@ -1899,18 +1899,17 @@
 _version
- -
+:
  Version
@@ -1980,26 +1980,25 @@
 am setup_url
- -
+:
  URL with Th
@@ -2042,26 +2042,25 @@
  support_url
- -
+:
  URL that us
@@ -2146,18 +2146,17 @@
 date_url
- -
+:
  URL tha
@@ -2240,18 +2240,17 @@
 firmware
- -
+:
  Version
@@ -2303,18 +2303,17 @@
 settings
- -
+:
  Current
@@ -2391,18 +2391,17 @@
 ic_state
- -
+:
  Current
@@ -2447,18 +2447,17 @@
 bilities
- -
+:
  Thing c
@@ -2491,18 +2491,17 @@
 capsHash
- -
+:
  A hash 
@@ -2675,18 +2675,17 @@
 aram tag
- -
+:
  Tags (f
@@ -2899,10 +2899,9 @@
 data
- -
+:
  Pri
@@ -3141,16 +3141,841 @@
 @return%0A
+     * The JSON response object contains a Boolean success indicator, the XSRF token used, %0A     * a listing of the request parameters, and a list of printers consisting of a single entry %0A     * which contains the fields of the printer added in the request.%0A     * %09%09registration_token: a human readable string the user will need to claim Thing ownership%0A%09 * %09%09token_duration: the lifetime of the registration_token, in seconds (the whole registration has to finish within this time frame)%0A%09 * %09%09invite_url: the url that a user will need to visit to claim ownership of the Thing%0A%09 * %09%09complete_invite_url: same thing of invite_url but already containing the registration_token, so that the user doesn't have to insert it manually%0A%09 * %09%09polling_url: the url that the Thing will need to poll for the OAuth2 authorization_code%0A
      */%0A

Update comment.