package es.uv.saic.feign;

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

import org.springframework.cloud.openfeign.FeignClient;
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.SupervisionSearchParams;

@FeignClient(name = "saic-core-service", contextId = "superivision-controller")
public interface SupervisionClient {

    @PostMapping("/supervision")
    HashMap<String, Object> supervisionForm(
        @RequestParam("usuari") String usuari, 
        @RequestBody Optional<SupervisionSearchParams> ssp
    );

    @PostMapping("/supervision/search")
    HashMap<String, Object> supervisionSearch(
        @RequestParam(name="centers[]", required=false) List<Integer> centres,
        @RequestParam("years[]") List<Integer> cursos,
        @RequestParam("titulations[]") List<Integer> titulacions,
        @RequestParam(name="procedures[]", required=false) List<String> procediments,
        @RequestParam(name="evidences[]", required=false) List<String> evidencies,
        @RequestParam(name="searchType", required=false) String searchType,
        @RequestParam("usuari") String usuari
    );
    
    @PostMapping("/supervision/restore") 
    HashMap<String, Object> restoreSearch(
        @RequestParam("usuari") String usuari, 
        @RequestBody SupervisionSearchParams ssp 
    );
}