package de.jottyfan.camporganizer.module.confirmation.confirmation;

import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author jotty
 *
 */
@Controller
public class SearchController {

	@Autowired
	private HttpServletRequest request;

	@Autowired
	private IConfirmationService service;

	@GetMapping("/confirmation/search")
	@ResponseBody
	public String search(@PathParam(value = "needle") String needle, Model model) {
		return service.search(needle, request.getRequestURI().replace("search", "person"), request);
	}
}
