package cn.ey.biz.module.system.api.bpm;

import cn.ey.biz.common.pojo.R;
import cn.ey.biz.module.system.api.bpm.dto.*;
import cn.ey.biz.module.system.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Valid;
import java.util.List;

@FeignClient(name = ApiConstants.NAME)
@Api(tags = "RPC 服务 - 工作流相关")
public interface BpmApi {

    String PREFIX = ApiConstants.PREFIX + "/bpm/process-instance";

    @PostMapping(PREFIX + "/create")
    @ApiOperation("新建流程实例")
    R<String> createProcessInstance(@Valid @RequestBody BpmProcessInstanceCreateDTO createDTO);

    @PostMapping(PREFIX + "/workflow-request")
    @ApiOperation("获取流程信息")
    R<BpmWorkflowRespDTO> getWorkflowRequest(@Valid @RequestBody BpmWorkflowDTO workflowDTO);

    @PostMapping(PREFIX + "/approve")
    @ApiOperation("通过任务(提交)")
    R<Boolean> approveTask(@Valid @RequestBody BpmTaskApproveDTO workflowDTO);

    @PostMapping(PREFIX + "/reject")
    @ApiOperation("不通过任务(驳回)")
    R<Boolean> rejectTask(@Valid @RequestBody BpmTaskRejectDTO workflowDTO);

    @PostMapping(PREFIX + "/get-operator-info")
    @ApiOperation("获取流程流转数据")
    R<List<BpmOperatorInfoRespDTO>> getRequestOperatorInfo(@Valid @RequestBody BpmOperatorInfoDTO operatorInfoDTO);

    @PostMapping(PREFIX + "/approve-nominator")
    @ApiOperation("通过任务(指定审核人)")
    R<Boolean> approveTaskNominator(@Valid @RequestBody BpmTaskApproveNominatorDTO nominatorDTO);

    @PostMapping(PREFIX + "/withdraw-request")
    @ApiOperation("流程撤回")
    R<Boolean> withdrawRequest(@Valid @RequestBody BpmWithdrawRequestDTO  bpmWithdrawRequestDTO);

    @PostMapping(PREFIX + "/get-statusById")
    @ApiOperation("流程状态获取")
    R<String> getStatusById(@Valid  @RequestBody BpmGetStatusByIdDTO bpmGetStatusByIdDTO);

    @PostMapping(PREFIX + "/do-Force-Over")
    @ApiOperation("强制归档(撤销)")
    R<Boolean> doForceOver(@Valid  @RequestBody BpmDoForceOverDTO bpmDoForceOverDTO);

    @PostMapping(PREFIX + "/receive-request-Info-byjson")
    @ApiOperation("接收异构系统流程接口(统一待办)")
    R<ReceiveRequestInfoByJsonRespDTO> receiveRequestInfoByJson(@Valid @RequestBody  ReceiveRequestInfoByJsonDTO receiveDTO);

    @PostMapping(PREFIX + "/delete-userrequest-info-byjson")
    @ApiOperation("删除异构系统指定人员待办流程(统一待办)")
    R<DeleteUserRequestInfoByJsonRespDTO> deleteUserRequestInfoByJson(@Valid @RequestBody DeleteUserRequestInfoByJsonDTO deleteDTO);

    @PostMapping(PREFIX + "/add-agent-save")
    @ApiOperation("流程代理")
    R<Boolean> addAgentSave(@Valid @RequestBody BpmAddAgentSaveDTO saveDTO);

    @PostMapping(PREFIX + "/delete-request")
    @ApiOperation("流程删除")
    R<Boolean> deleteRequest(@Valid @RequestBody BpmDeleteRequestDTO deleteDTO);

    @PostMapping(PREFIX + "/check-operator-and-shared")
    @ApiOperation("验证用户是否是当前流程操作者")
    R<Boolean> checkOperatorAndShared(@Valid @RequestBody CheckOperatorAndSharedRequestDTO OperatorDTO );

}
