package es.uv.saic.feign;

import java.io.IOException;
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 es.uv.saic.domain.Datasource;
import es.uv.saic.dto.ImportDTO;
import es.uv.saic.dto.IndicadorEnquestaTmpDup;
import es.uv.saic.dto.TablaDTO;

@FeignClient(value = "data-service", url = "${saic.url.data.domain}")
public interface DataClient {

    @GetMapping("/data/import")
    public List<Datasource> renderImport();

    @PostMapping("/data/import")
    public String uploadFile(ImportDTO importDto) throws IOException;

    @PostMapping("/data/view/columns")
    public List<String> listTableColumns(@RequestBody TablaDTO tablaDTO);

    @PostMapping("/data/check/{type}")
    public List<IndicadorEnquestaTmpDup> check(@RequestBody String enquesta, @PathVariable Integer type) throws IOException;

    @GetMapping("/data/sources")
	public List<Datasource> getDatasources() throws IOException;

    @PostMapping("/data/count")
	public Integer countByEnquesta(@RequestBody String enquesta) throws IOException;

    @PostMapping("/data/consolidate")
	public Integer consolidate(@RequestBody String enquesta) throws IOException;
    
}