package es.uv.saic.feign;

import java.util.HashMap;
import java.util.List;

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.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import es.uv.saic.domain.Categoria;
import es.uv.saic.domain.Grafica;
import es.uv.saic.domain.Indicador;
import es.uv.saic.domain.Link;
import es.uv.saic.dto.CategoriaDocumentDTO;
import es.uv.saic.dto.InstanciaGanttDTOImp;

@FeignClient(name = "saic-core-service", contextId = "dashboard-controller")
public interface DashboardClient {
    @PostMapping("/dashboard")
	@ResponseBody
	public HashMap<String, Object> getOrganList(@RequestBody String usuari);

    @PostMapping("/dashboard/{ruct}")
	@ResponseBody
	public HashMap<String, Object> getDashboardOrgan(@PathVariable Integer ruct, @RequestBody String usuari);

    @PostMapping("/dashboard/procedures/{idTitulacio}")
	@ResponseBody
	public List<?> loadReports(@PathVariable Integer idTitulacio);

    @GetMapping("/dashboard/documents/{idTitulacio}")
	@ResponseBody
	public List<CategoriaDocumentDTO> loadDocuments(@PathVariable Integer idTitulacio);

    @GetMapping("/dashboard/gantt/{ruct}")
	@ResponseBody
	public List<InstanciaGanttDTOImp> loadGantt(@PathVariable Integer ruct);

    @GetMapping("/dashboard/documents/cats/{idCategoria}/{tambit}")
	@ResponseBody
	public List<Categoria> getDocumentChildCats(@PathVariable Integer idCategoria, @PathVariable String tambit);

    @GetMapping("/dashboard/documents/catsu/{idCategoria}/{tambit}")
	@ResponseBody
	public List<Categoria> getDocumentChildCatsU(@PathVariable Integer idCategoria, @PathVariable String tambit);

    @PostMapping("/dashboard/documents")
	@ResponseBody
	public void uploadDocument(@RequestParam MultipartFile file, @RequestParam Integer idCategoria, 
							   @RequestParam Integer lugar, @RequestParam String tlugar);
    
    @PostMapping("/dashboard/documents/archive")
	@ResponseBody
	public void archiveDocuments(@RequestParam Integer lugar, @RequestParam String tlugar);

    @GetMapping("/dashboard/graphs/list/{ruct}")
	@ResponseBody
	public List<Grafica> getGraphDataList(@PathVariable Integer ruct);

    @GetMapping("/dashboard/graphs/rates/{lugar}")
	@ResponseBody
	public List<Indicador> getGraphDataTaxes(@PathVariable Integer lugar);

	@GetMapping("/dashboard/graphs/inds/{ruct}/{tambit}")
	@ResponseBody
	public List<Indicador> getGraphDataByRuctTambit(@PathVariable Integer ruct, @PathVariable String tambit);

    @GetMapping("/dashboard/graphs/inds/{ruct}")
	@ResponseBody
	public List<Indicador> getGraphDataByRuct(@PathVariable Integer ruct);

    @GetMapping("/dashboard/links/{ruct}")
	@ResponseBody
	public List<Link> getLinks(@PathVariable Integer ruct);

    @PostMapping("/dashboard/links/{ruct}")
	@ResponseBody
	public Link createLink(@PathVariable Integer ruct, @RequestParam String dataExp);

    @DeleteMapping("/dashboard/links/{id}")
	@ResponseBody
	public Integer deleteLink(@PathVariable Integer id);
}