package fi.solita.botsofbf;

import fi.solita.botsofbf.dto.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.UUID;


@RestController
public class GameController {

    @Autowired
    private GameEngine gameEngine;

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public RegisterResponse register(@RequestBody Registration registration) {
        return gameEngine.registerPlayer(registration.playerName, registration.url);
    }

    @RequestMapping("/foo")
    public @ResponseBody String foo() throws IOException {
        return "bar";
    }

    @RequestMapping(value = "/{playerId}/say", method = RequestMethod.POST)
    public void say(@PathVariable String playerId, @RequestBody String message) {
        gameEngine.say(UUID.fromString(playerId), message);
    }

    @RequestMapping(value = "/restart", method = RequestMethod.POST)
    public void restart() {
        gameEngine.restart();
    }

    @RequestMapping(value = "/changemap", method = RequestMethod.POST)
    public void changeMap(@RequestBody String map) throws IOException {
        gameEngine.changeMap(map);
    }

    /*
    @RequestMapping(value = "/move", method = RequestMethod.POST)
    public @ResponseBody GameState move(@RequestBody PlayerMove move) {
        return gameEngine.movePlayer(UUID.fromString(move.id), move.move);
    }
    */

}

@@ -33,197 +33,515 @@
 ort 
-fi.solita.botsofbf.dto.*;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.web.bind.annotation.*;%0A%0Aimport java.io.IOException;%0Aimport java.util.UUID
+java.io.IOException;%0Aimport java.util.UUID;%0A%0Aimport fi.solita.botsofbf.dto.RegisterResponse;%0Aimport fi.solita.botsofbf.dto.Registration;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestBody;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0Aimport org.springframework.web.bind.annotation.RestController
 ;%0A%0A%0A
@@ -883,124 +883,8 @@
  %7D%0A%0A
-    @RequestMapping(%22/foo%22)%0A    public @ResponseBody String foo() throws IOException %7B%0A        return %22bar%22;%0A    %7D%0A%0A
     
@@ -1427,240 +1427,6 @@
  %7D%0A%0A
-    /*%0A    @RequestMapping(value = %22/move%22, method = RequestMethod.POST)%0A    public @ResponseBody GameState move(@RequestBody PlayerMove move) %7B%0A        return gameEngine.movePlayer(UUID.fromString(move.id), move.move);%0A    %7D%0A    */%0A%0A
 %7D%0A

Remove unused code from GameController.