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(name = "saic-core-service", contextId = "organ-controller")
public interface OrganClient {
    @GetMapping("/organs")
    List<OrganDTO> getCentres();

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

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

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

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

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

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

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

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

    @PostMapping("/organs/titulacions/calendar")
	public HashMap<String, Object> getTitulationsByCenters(@RequestParam("centers[]") List<Integer> centres, @RequestParam("procedure") Integer idProces);

    @PostMapping("/organs/titulacions/admin")
	public HashMap<String, Object> getTitulationsByCenter(@RequestParam("center") Integer centre, @RequestParam("procedure") Integer idProces);

    @PostMapping("/organs/titulacions")
	public HashMap<String, Object> getAllTitulationsByCenter(@RequestParam("center") Integer centre);

    @PostMapping("/organs/centres")
	public HashMap<String, Object> getAllCentresByAmbit(@RequestParam("procedure") Integer idProces);

    @PostMapping("/organs/equivalents")
	public List<Integer> getEquivalents(@RequestParam Integer lugar, @RequestParam String tlugar);
}

