package ch.opendata.smn.resource;

import ch.opendata.smn.api.SmnRecord;
import ch.opendata.smn.core.GeoAdmin;
import com.codahale.metrics.annotation.Timed;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.Collection;

@Path("/smn")
@Api(value = "/smn", description = "Operations about SwissMetNet SMN")
@Produces(MediaType.APPLICATION_JSON)
public class SmnResource {
  private final GeoAdmin geoAdmin;

  public SmnResource(GeoAdmin geoAdmin) {
    this.geoAdmin = geoAdmin;
  }

  @GET
  @Timed
  @ApiOperation(value = "Find pet by ID", notes = "More notes about this method", response = Collection.class)
  @ApiResponses(value = {
    @ApiResponse(code = 400, message = "Invalid ID supplied"),
    @ApiResponse(code = 404, message = "Pet not found")
  })
  public Collection<SmnRecord> list() throws IOException {
    return geoAdmin.getSmnData().getAllRecords();
  }

  @GET
  @Timed
  @Path("/{code}")
  public SmnRecord getSmnRecord(@PathParam("code") String code) throws IOException {
    return geoAdmin.getSmnData().getRecordFor(code);
  }
}

@@ -250,113 +250,8 @@
 ion;
-%0Aimport com.wordnik.swagger.annotations.ApiResponse;%0Aimport com.wordnik.swagger.annotations.ApiResponses;
 %0A%0Aim
@@ -477,17 +477,16 @@
 alue = %22
-/
 smn%22, de
@@ -502,24 +502,27 @@
  = %22
-Operations about
+Methods to retrieve
  Swi
@@ -534,11 +534,13 @@
 Net 
-SMN
+data.
 %22)%0A@
@@ -574,16 +574,36 @@
 ION_JSON
+ + %22; charset=UTF-8%22
 )%0Apublic
@@ -781,391 +781,485 @@
  = %22
-Find pet by ID%22, notes = %22More notes about this method%22, response = Collection.class)%0A  @ApiResponses(value = %7B%0A    @ApiResponse(code = 400, message = %22Invalid ID supplied%22),%0A    @ApiResponse(code = 404, message = %22Pet not found%22)%0A  %7D)%0A  public Collection%3CSmnRecord%3E list() throws IOException %7B%0A    return geoAdmin.getSmnData().getAllRecords();%0A  %7D%0A%0A  @GET%0A  @Timed%0A  @Path(%22/%7Bcode%7D%22
+Get all data from all SMN stations%22, notes = %22Data is cache with a short TTL%22,%0A    response = SmnRecord.class, responseContainer = %22List%22)%0A  public Collection%3CSmnRecord%3E list() throws IOException %7B%0A    return geoAdmin.getSmnData().getAllRecords();%0A  %7D%0A%0A  @GET%0A  @Timed%0A  @Path(%22/%7Bcode%7D%22)%0A  @ApiOperation(value = %22Get data for a single SMN station%22, notes = %22The 'code' parameter is expected to be %22%0A    + %22upper-case. Data is cache with a short TTL%22, response = SmnRecord.class
 )%0A  

Add proper API documentation (swagger annotations).