package com.yuchen.saas.integration.feign.api.feign;

import com.yuchen.saas.integration.feign.api.dto.ActRuApprovalDataDto;
import com.yuchen.saas.integration.feign.api.dto.AuditParam;
import com.yuchen.saas.integration.feign.api.dto.UpdateActHiTaskParam;
import com.yuchen.saas.integration.feign.api.entity.ActRuApprovalData;
import com.yuchen.saas.integration.feign.api.entity.ActRuTask;
import com.yuchen.saas.integration.feign.api.vo.ActTaskResultVO;
import com.yuchen.saas.integration.feign.api.vo.ProcessVo;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

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

/**
 * 审批流
 */
@FeignClient(
		value = AppNameConstant.SAAS_DEVICE_INTEGRATED,
		fallback = ActApprovalClientFallback.class
)
public interface ActApprovalClient {

	/**
	 * 事物回滚流程接口
	 * @return
	 */
	@GetMapping("/actApproval/rollBackApproval")
	R rollBackApproval(@RequestParam String ruApprovalDataId);

	/**
	 * 发起自定义流程申请
	 * @return
	 */
	@PostMapping("/actApproval/startProcess")
	R startProcess(@RequestBody ActRuApprovalDataDto entity);

	/**
	 * 发起自定义流程申请2(含是否开启自动审核,开的话如果包含审核人会自动审核到发起人
	 * @return
	 */
	@PostMapping("/actApproval/startProcessAuto")
	R<ActTaskResultVO> startProcessAuto(@RequestBody ActRuApprovalDataDto entity);

	/**
	 * 审批人对申请进行审批
	 * @param entity
	 * @return
	 */
	@PostMapping("/actApproval/auditTask")
	R<List<ActRuApprovalData>> auditTask(@RequestBody AuditParam entity);

	@GetMapping(value = "/actApproval/getProcessList")
	R<ProcessVo>getProcessList(@RequestParam String ruApprovalDataId);

	@PostMapping("/actApproval/cancel")
	R cancel(@RequestBody String ruApprovalDataId);

	@GetMapping("/actApproval/getRuTask")
	R<ActRuTask> gerRuTaskByDataId(@RequestParam String ruApprovalDataId);

	@GetMapping("/actApproval/findRuTaskListByType")
	R<List<ActRuTask>> findRuTaskListByType(@RequestParam String actType, @RequestParam(required = false) Long parkId);


	@GetMapping("/actApproval/getRuTaskById")
	R<ActRuTask> getRuTaskById(@RequestParam String ruTaskId);

	/**
	 * 修改信息提交时的审核消息,只能是待审核状态
	 * @param updateActHiTaskParam
	 * @return
	 */
	@PostMapping("/actApproval/updateByDataId")
	R updateByDataId(@RequestBody UpdateActHiTaskParam updateActHiTaskParam);

	@GetMapping("/actApproval/getRuTaskCount")
	R<Integer> getRuTaskCount(@RequestParam String actType,@RequestParam(required = false) String parkId);

	@GetMapping("/actApproval/getAllRuTaskCount")
	R<Integer> getAllRuTaskCount(@RequestParam String actType,@RequestParam(required = false) String parkId);


	@GetMapping("/actApproval/findUserAllRuTaskList")
	R<List<ActRuTask>> findUserAllRuTaskList();
}
