// Path: server/src/main/java/fi/solita/botsofbf/dto/Move.java
// public enum Move {
//     UP,
//     DOWN,
//     RIGHT,
//     LEFT,
//     randomMove, PICK,
//     USE
// }
// 
// Path: server/src/main/java/fi/solita/botsofbf/dto/Registration.java
// public class Registration {
//     public String playerName;
//     public String url;
// 
//     public Registration(@JsonProperty("playerName") String playerName, @JsonProperty("url") String url) {
//         this.playerName = playerName;
//         this.url = url;
//     }
// }


import fi.solita.botsofbf.dto.Move;
import fi.solita.botsofbf.dto.Registration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
package fi.solita.botsofbf;




@RestController
public class ExampleBots {

    private RegisterResponse_ leftie;
    private RegisterResponse_ zombie;

    @RequestMapping(value = "/startleftie", method = RequestMethod.POST)
    public void registerLeftie() {
        leftie = reg("leftie", "/leftie");
    }

    @RequestMapping(value = "/startzombie", method = RequestMethod.POST)
    public void registerZombie() {
        zombie = reg("zombie", "/zombie");
    }

    @RequestMapping(value = "/starthunters", method = RequestMethod.POST)
    public Set<RegisterResponse_> registerHunter(@RequestBody int num) {
        return IntStream.rangeClosed(1, num)
                .mapToObj(n -> reg("hunter " + n, "/hunter"))
                .collect(Collectors.toSet());

        /*
        for (int i = 0; i < num; i++) {
            RegisterResponse_ registerResponse = reg("hunter " + i, "/hunter");
            System.out.println("hunter " + i + " registered and got id " + registerResponse.id);
        }
        */
    }

    private RegisterResponse_ reg(String playerName, String url) {
        RestTemplate restTemplate = new RestTemplate();
// Path: server/src/main/java/fi/solita/botsofbf/dto/Move.java
// public enum Move {
//     UP,
//     DOWN,
//     RIGHT,
//     LEFT,
//     randomMove, PICK,
//     USE
// }
// 
// Path: server/src/main/java/fi/solita/botsofbf/dto/Registration.java
// public class Registration {
//     public String playerName;
//     public String url;
// 
//     public Registration(@JsonProperty("playerName") String playerName, @JsonProperty("url") String url) {
//         this.playerName = playerName;
//         this.url = url;
//     }
// }


// Path: server/src/main/java/fi/solita/botsofbf/ExampleBots.java
import fi.solita.botsofbf.dto.Move;
import fi.solita.botsofbf.dto.Registration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

package fi.solita.botsofbf;




@RestController
public class ExampleBots {

    private RegisterResponse_ leftie;
    private RegisterResponse_ zombie;

    @RequestMapping(value = "/startleftie", method = RequestMethod.POST)
    public void registerLeftie() {
        leftie = reg("leftie", "/leftie");
    }

    @RequestMapping(value = "/startzombie", method = RequestMethod.POST)
    public void registerZombie() {
        zombie = reg("zombie", "/zombie");
    }

    @RequestMapping(value = "/starthunters", method = RequestMethod.POST)
    public Set<RegisterResponse_> registerHunter(@RequestBody int num) {
        return IntStream.rangeClosed(1, num)
                .mapToObj(n -> reg("hunter " + n, "/hunter"))
                .collect(Collectors.toSet());

        /*
        for (int i = 0; i < num; i++) {
            RegisterResponse_ registerResponse = reg("hunter " + i, "/hunter");
            System.out.println("hunter " + i + " registered and got id " + registerResponse.id);
        }
        */
    }

    private RegisterResponse_ reg(String playerName, String url) {
        RestTemplate restTemplate = new RestTemplate();
        Registration registration = new Registration(playerName, "http://localhost:8080" + url);