package eu.dnetlib.is.protocol;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ajax/protocols")
public class ProtocolAjaxController extends AbstractProtocolController {

	@DeleteMapping("/{protocol}")
	public List<ProtocolDesc> deleteProtocol(@PathVariable final String protocol) {
		protocolService.deleteProtocols(protocol);
		return protocolService.listProtocols();
	}

	@PostMapping("/{protocol}/terms")
	public List<ProtocolDesc> saveTerm(@PathVariable final ProtocolDesc protocol) {
		protocolService.saveProtocol(protocol);
		return protocolService.listProtocols();
	}

}
