package com.steerinfo.util;

import com.steerinfo.framework.controller.RESTfulResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient(value = "activiti-service",path = "/v1/act",fallback = ActivitiClientFallback.class)
public interface ActivitiClient {

    /**
     * 启动流程
     * @param formKey
     * @param userId
     * @param entity
     * @return
     */
    @PostMapping("/startProcess/var")
    public RESTfulResult startProcess(@RequestParam("formKey") String formKey, @RequestParam("userId") String userId, @RequestBody Process entity);

    /**
     * 我的代办任务
     * @return
     */
    @GetMapping("/myToDoTask")
    public RESTfulResult myToDoTask(@RequestParam("formKey") String formKey, @RequestParam("userId") String userId);

    /**
     * 完成任务
     * taskMap {"taskId":"2648","instanceId":"2620","userIds":""}
     * @param userId
     * @param remark
     * @return
     */
    @PostMapping("/completeProcess")
    public RESTfulResult completeProcess(@RequestParam("userId") String userId,
                                         @RequestParam("remark") String remark, @RequestBody Map taskMap);

    /**
     * 获取实时流程图片
     * @param id 取我的代办列表中的instanceId
     * @return
     */
    @GetMapping("/queryProImg/{processInstanceId}")
    public feign.Response queryProImg(@PathVariable("processInstanceId") String id);

    @GetMapping("/getTaskByBusinessId/{businessId}")
    public RESTfulResult getTaskByBusinessId(@PathVariable("businessId") String businessId, @RequestParam("formKey") String formKey);

    /**
     * 驳回
     * @param reason
     * @param taskId
     * @param userId
     * @return
     */
    @GetMapping("/rejectProcess")
    public RESTfulResult rejectProcess(@RequestParam("reason") String reason, @RequestParam("taskId") String taskId, @RequestParam("userId") String userId);

    /**
     * 直接结束流程
     * @param reason
     * @param formKey
     * @param userId
     * @return
     */
    @GetMapping("/endProcess")
    public RESTfulResult endProcess(@RequestParam("reason") String reason, @RequestParam("formKey") String formKey, @RequestParam("userId") String userId);
}
