package com.jasamedika.medifirst2000.controller.base;

import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static org.springframework.web.bind.annotation.RequestMethod.*;

/**
 * Base Rest Operation for Controller Class
 * 
 * @author Roberto
 */
public interface IBaseRestController<V extends BaseModelVO> extends IRestPageController<V> {

	@RequestMapping(value = "/{id}", method = GET)
	@ResponseBody
	ResponseEntity<V> getVO(@PathVariable("id") Integer id);

	@RequestMapping(value = "/", method = POST, consumes = { "application/json" })
	@ResponseBody
	ResponseEntity<String> addVO(@RequestBody V vo);

	@RequestMapping(value = "/", method = PUT, consumes = { "application/json" })
	@ResponseBody
	ResponseEntity<String> editVO(@RequestBody V vo);

	@RequestMapping(value = "/{id}", method = DELETE)
	@ResponseBody
	ResponseEntity<String> deleteVO(@PathVariable("id") Integer id);

	@RequestMapping(value = "/", method = GET)
	@ResponseBody
	ResponseEntity<List<V>> getAllVO();

}
