package com.njcn.supervision.api;

import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
import com.njcn.bpm.pojo.vo.TodoVO;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.fallback.BusinessCommonFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;
import java.util.Set;


/**
 * 流程实例 Api 接口
 *
 * @author 芋道源码
 */
@FeignClient(value = ServerInfo.SUPERVISION, path = "/supervision", fallbackFactory = BusinessCommonFeignClientFallbackFactory.class)
public interface BusinessCommonFeignClient {

    /**
     * 根据流程key,业务id去实时更新流程状态
     *
     * @param processKey 流程定义key
     * @param businessId 业务id
     * @param status     目标状态
     */
    @GetMapping("/updateProcessStatus")
    HttpResult<Object> updateProcessStatus(@RequestParam("processKey") String processKey, @RequestParam("businessId") String businessId, @RequestParam("reason") String reason, @RequestParam("status") Integer status);


    /**
     * 根据流程key,业务id去实时更新流程状态
     *
     * @param processKey 流程定义key
     * @param businessId 业务id
     */
    @GetMapping("/getInstanceInfo")
    HttpResult<BpmInstanceInfo> getInstanceInfo(@RequestParam("processKey") String processKey, @RequestParam("businessId") String businessId);

    /**
     * 获取当前用户所有不通过的流程实例ID
     */
    @GetMapping("/getAllRejectInstanceId")
    HttpResult<Set<String>> getAllRejectInstanceId();

    /**
     * 获取当前用户部分待办业务，回显在待办列表中
     */
    @GetMapping("/getTodoBusiness")
    HttpResult<List<TodoVO>> getTodoBusiness();
}
