package com.persenkultra.times.rest;

import java.util.List;

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

import com.persenkultra.times.model.Runner;
import com.persenkultra.times.service.RunnerService;
import com.persenkultra.times.service.Services;

@Path("runners")
public class RunnerRest {
	private final RunnerService runnerService;

	public RunnerRest() {
		runnerService = Services.getRunnerService();
	}

	@GET
	@Path("/")
	@Produces({ MediaType.APPLICATION_JSON })
	public List<Runner> getRunners() {
		return runnerService.getRunners();
	}

	@GET
	@Path("/{runnerId}")
	@Produces({ MediaType.APPLICATION_JSON })
	public Runner getRunner(@PathParam("runnerId") long runnerId) {
		return runnerService.getRunner(runnerId);
	}
	
	@POST
	@Path("/")
	@Produces({ MediaType.APPLICATION_JSON })
	public Runner createRunner(Runner runner) {
		return runnerService.createRunner(runner);
	}
	
	@PUT
	@Path("/{runnerId}")
	@Produces({ MediaType.APPLICATION_JSON })
	public Runner updateRunner(@PathParam("runnerId") long runnerId, Runner runner) {
		return runnerService.updateRunner(runnerId, runner);
	}
	
	

}

@@ -51,24 +51,51 @@
 util.List;%0A%0A
+import javax.ws.rs.DELETE;%0A
 import javax
@@ -1277,13 +1277,198 @@
 );%0A%09%7D%0A%09%0A
+%09@DELETE%0A%09@Path(%22/%7BrunnerId%7D%22)%0A%09@Produces(%7B MediaType.APPLICATION_JSON %7D)%0A%09public void deleteRunner(@PathParam(%22runnerId%22) long runnerId) %7B%0A%09%09runnerService.deleteRunner(runnerId);%0A%09%7D%0A%09%0A
 %09%0A%0A%7D%0A

Delete runner via REST