package com.mortals.xhx.feign.flowable;

import com.mortals.xhx.common.pdu.api.ApiRespPdu;
import com.mortals.xhx.common.pdu.flow.FlowTaskVoPdu;
import com.mortals.xhx.common.pdu.flow.FlowViewerPdu;
import com.mortals.xhx.feign.IFeign;
import com.mortals.xhx.feign.processinstance.ProcessCommonReq;
import com.mortals.xhx.feign.processinstance.ProcessDeleteReq;
import com.mortals.xhx.feign.processinstance.ProcessStopReq;
import com.mortals.xhx.feign.processinstance.ProcessUpdateStateReq;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.feign.runtime.StartProcessInstanceReq;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 工作流流程实例
 *
 * @author: finegirl
 * @date: 2021/7/31 19:52
 */
@FeignClient(name = "workflow-manager",path = "/m")
public interface IApiFlowInstanceFeign extends IFeign {

    /**
     * 启动流程
     *
     * @param req
     * @return
     */
    @PostMapping("/api/flow/process/start")
    ApiResp<String> processStart(@RequestBody StartProcessInstanceReq req);

    /**
     * 激活或挂起流程实例
     *
     * @param req
     * @return
     */
    @PostMapping("/api/flow/process/updateState")
    ApiResp updateState(@RequestBody ProcessUpdateStateReq req);

    /**
     * 终止流程
     *
     * @param req
     * @return
     */
    @PostMapping("/api/flow/process/stop")
    ApiResp<String> stopProcess(@RequestBody ProcessStopReq req);

    /**
     * 删除流程
     *
     * @param req
     * @return
     */
    @PostMapping("/api/flow/process/delete")
    ApiResp<String> deleteProcess(@RequestBody ProcessDeleteReq req);


    /**
     * 获取流程执行过程
     *
     * @param req
     * @return
     */
    @PostMapping("/api/flow/process/getFlowViewer")
    ApiResp<List<FlowViewerPdu>> getFlowViewer(@RequestBody ProcessCommonReq req);


    /**
     * 根据流程实例ID 获取当前流程运行情况 返回BASE64图片
     *
     * @param req
     * @return base64图片数据
     */
    @PostMapping("/api/flow/process/getImage")
    ApiResp<String> processReadImage(@RequestBody ProcessCommonReq req);


    @PostMapping("/api/flow/process/getAllProcessInstanceEl")
     ApiResp<List<FlowTaskVoPdu>> getAllProcessInstanceEl(@RequestBody StartProcessInstanceReq req);

}