package es.uv.saic.feign;

import java.util.List;
import java.util.Optional;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import es.uv.saic.domain.Calendari;

@FeignClient(name = "saic-core-service", contextId = "calendar-controller")
public interface CalendarClient {
        @ResponseBody
	@PostMapping("/calendar")
	public Calendari calendarAddEvent(@RequestParam("idProces") Integer idProces, 
        @RequestParam("titulacions") List<String> titulacions, @RequestParam("centres") List<String> centres, 
        @RequestParam("data") String data, @RequestParam("instancia") Optional<Integer> instancia);

    @ResponseBody
	@PostMapping("/calendar/{id}")
	public Calendari calendarAddEvent(@PathVariable("id") Integer id, 
        @RequestParam("idProces") Integer idProces, @RequestParam("titulacions") List<String> titulacions, 
        @RequestParam("centres") List<String> centres, @RequestParam("data") String data);

    @ResponseBody
	@GetMapping("/calendar")
	public List<Calendari> calendarGetEvents();

    @ResponseBody
	@DeleteMapping("/calendar")
	public Integer calendarDeleteEvent(@RequestParam("id") Integer id);

    @ResponseBody
	@PostMapping("/calendar/instantiate")
    public List<String> instantiate(@RequestParam("id") Integer id,
        @RequestParam("idProces") Integer idProces, @RequestParam("centres") List<Integer> centres,
        @RequestParam("titulacions") List<Integer> titulacions, @RequestParam String usuari);   
}
