package es.uv.saic.feign;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
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 es.uv.saic.domain.IndicadorEnquesta;
import es.uv.saic.domain.Usuari;
import es.uv.saic.dto.OrganDTO;

@FeignClient(value = "organ-controller", url = "${saic.url.domain}")
public interface OrganClient {
    @GetMapping("/getCentres")
    List<OrganDTO> getCentres();

    @GetMapping("/getActiveCentres")
    List<OrganDTO> getActiveCentres();

    @GetMapping("/getTitulacionsWithCentre")
    public List<OrganDTO> getTitulacionsWithCentre();
    
    @GetMapping("/getAllIndsByRuct/{ruct}/{curs}")
    public List<IndicadorEnquesta> getAllIndsByRuct(@PathVariable Integer ruct, @PathVariable Integer curs);

    @GetMapping("/findById/{tlugar}/{idTitulacio}")
    public OrganDTO findByID(@PathVariable String tlugar,  @PathVariable Integer idTitulacio);

    @GetMapping("/getTitulacions/supervisor")
    public List<OrganDTO> getTitulacionsSupervisor();
     
    @GetMapping("/getTitulacionsByCentre/{centre}")
    public List<OrganDTO> getTitulacionsByCentre(@PathVariable Integer centre);

    @PostMapping("/findOrgansByUsuari")
    public List<OrganDTO> findOrgansByUsuari(@RequestBody Usuari usuari);

    @GetMapping("/findByRuct/{ruct}")
    public OrganDTO findByRuct(@PathVariable Integer ruct);

    @PostMapping("/ajax/search/titulations")
	public HashMap<String, Object> getTitulationsByCenter(@RequestParam(name="centers[]", required=false) List<Integer> centres,
        @RequestParam String usuari ) throws IOException;

    @PostMapping("/ajax/search/managers/titulations")
	public HashMap<String, Object> getCenterTitulations(@RequestParam("center") Integer centre);

    @PostMapping("/ajax/find/titulations2")
	public HashMap<String, Object> getTitulationsByCenters(@RequestParam("centers[]") List<Integer> centres, @RequestParam("procedure") Integer idProces) throws IOException;

    @PostMapping("/ajax/find/titulations")
	public HashMap<String, Object> getTitulationsByCenter(@RequestParam("center") Integer centre, @RequestParam("procedure") Integer idProces) throws IOException;

    @PostMapping("/ajax/get/titulations")
	public HashMap<String, Object> getAllTitulationsByCenter(@RequestParam("center") Integer centre) throws IOException;

    @PostMapping("/ajax/find/centers")
	public HashMap<String, Object> getAllCentresByAmbit(@RequestParam("procedure") Integer idProces) throws IOException;

    
}

