package com.hotent.base.feign;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.hotent.base.conf.DecryptingFeignConfig;
import com.hotent.base.entity.URIEntity;
import com.hotent.base.feign.impl.BpmModelFeignServiceFactory;
import com.hotent.base.model.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

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

/**
 * 
 * @author liyg
 *
 */
@FeignClient(name="eip-bpm-model",fallbackFactory = BpmModelFeignServiceFactory.class, configuration= DecryptingFeignConfig.class, primary = false)
public interface BpmModelFeignService {

	/**
	 * 获取常用语
	 * @param defKey
	 * @param typeId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/flow/approvalItem/v1/getApprovalByDefKeyAndTypeId",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
	public List<String> getApprovalByDefKeyAndTypeId(
			@RequestParam(value="defKey", required = true) String defKey,
			@RequestParam(value="typeId",required = true) String typeId,
			@RequestParam(name="userId",required=true) String userId);
	
	/**
	 * 执行催办任务
	 */
	@RequestMapping(value="/flow/bpmTaskReminder/v1/executeTaskReminderJob",method=RequestMethod.GET)
	public CommonResult<String>  executeTaskReminderJob();
	
	/**
	 * 检测bo是否已绑定流程
	 */
	@RequestMapping(value="/flow/def/v1/isBoBindFlowCheck",method=RequestMethod.GET)
	public CommonResult<Boolean> isBoBindFlowCheck(@RequestParam(value="boCode", required=true) String boCode,@RequestParam(value="formKey", required=true) String formKey);

	/**
	 * 根据流程定义id获取流程信息
	 */
	@RequestMapping(value="/flow/def/v1/defGet",method=RequestMethod.GET)
	public ObjectNode getDefGet(@RequestParam(value="defId", required=true) String defId);

	/**
	 * 获取我的常用流程key
	 */
	@RequestMapping(value="/bpmModel/BpmOftenFlow/v1/getMyOftenFlowKey",method=RequestMethod.GET)
	public Set<String> getMyOftenFlowKey();

	/**
	 * 获取我的常用流程key,未登录
	 */
	@RequestMapping(value="/bpmModel/BpmOftenFlow/v1/getMyOftenFlowKeyByNoAuth",method=RequestMethod.GET)
	public Set<String> getMyOftenFlowKeyByNoAuth();


	@RequestMapping(value = "/flow/def/v1/bpmDefinitionData",method=RequestMethod.GET)
	public List<Map<String, String>> bpmDefinitionData(@RequestParam(value="alias", required=true)String alias);

	@RequestMapping(value = "/flow/def/v1/getBindRelation",method=RequestMethod.GET)
	public Map<String, Object> definitionData(@RequestParam(value="defId", required=true)String defId);
	
	/**
	 * 根据流程定义获取是否允许套打印章
	 * @param defId
	 * @return
	 */
	@RequestMapping(value="/flow/def/v1/getAllowSignet",method=RequestMethod.GET)
	public CommonResult<Boolean> getAllowSignet(@RequestParam(value="defId", required=true) String defId);

	@RequestMapping(value = "/flow/def/v1/getJson",method=RequestMethod.GET)
	public ObjectNode getProcDefByDefKey(@RequestParam(value="defKey", required=true)String defKey);

	/**
	 * TODO 通过_流程别名获取导出信息
	 * @author: 梁宏锦
	 * @date: 2024/06/27
	 * @param defKey:
	 **/
	@RequestMapping(value = "/flow/def/v1/getExportXmlByDefKey",method=RequestMethod.GET)
	public Map<String, String> getExportXmlByDefKey(@RequestParam(value="defKey", required=true)String defKey);

	/**
	 * TODO 修改导出xml的别名信息
	 * @author: 梁宏锦
	 * @date: 2024/06/27
	 * @param jsonStr:
	 **/
	@RequestMapping(value = "/flow/def/v1/getExportXmlReplaceAlias",method=RequestMethod.POST)
	public Map<String, String> getExportXmlReplaceAlias(@RequestParam(value="jsonStr", required=true)String jsonStr);

	/**
	 * TODO 应用复制完整导入xml
	 * @author: 梁宏锦
	 * @date: 2024/06/27
	 * @param jsonStr:
	 **/
	@RequestMapping(value = "/flow/def/v1/importFullXml",method=RequestMethod.POST)
	public CommonResult<String> importFullXml(@RequestParam(value="jsonStr", required=true)String jsonStr);

	/**
	 * 根据导出文件获取_插入流程最新的id
	 * @param bpmdefsXml
	 * @return
	 */
	@RequestMapping(value = "/flow/def/v1/getBpmDefIdByXml",method=RequestMethod.POST)
	public CommonResult<String> getBpmDefIdByXml(@RequestParam(value="bpmdefsXml", required=true)String bpmdefsXml);

	/**
	 * TODO 应用复制删除流程
	 * @author: 梁宏锦
	 * @date: 2024/06/27
	 **/
	@RequestMapping(value = "/flow/def/v1/physicsRemoveAllVersionByIds",method=RequestMethod.DELETE)
	public CommonResult<String> physicsRemoveAllVersionByIds(@RequestParam(value="ids", required=true)String ids);


	/**
	 * 通过流程defId获取流程flowKey
	 * 
	 * @param defId
	 * @return
	 */
	@RequestMapping(value = "/flow/def/v1/getFlowKeyByDefId", method = RequestMethod.GET)
	public CommonResult<String> getFlowKeyByDefId(@RequestParam(value = "defId", required = true) String defId);

    @RequestMapping(value="/base/common/getMicroURIEntity",method=RequestMethod.GET)
    public Set<URIEntity> getMicroURIEntity();

}
