package com.blueland.bpm.engine.core.service;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import com.blueland.bpm.common.page.Page;
import com.blueland.bpm.common.util.ServiceResponse;
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
import com.blueland.bpm.engine.util.WorkFlowException;
/**
 * 流程管理配置Service
 * @version:  1.0
 * @author lw 
 */
public interface ProcessConfigService  extends ActivitiService{
	
	/**
	 * 获取流程绑定的界面路径
	 * 获取界面路径的优先级为：1:环节,2:流程
	 * @param processDefId
	 * @param activityDefId
	 * @param version
	 * @return
	 * @throws WorkFlowException
	 */
	public String getWorkflowPage(String processDefId,String activityDefId) throws WorkFlowException;
	
	/**
	 * 获取流程配置绑定的桌面端、手机端相关参数
	 * 获取数据的优先级为：1:环节,2:流程
	 * @param processDefId
	 * @param activityDefId
	 * @param version
	 * @return
	 * @throws WorkFlowException
	 */
	public Map<String,String> getPortalPage(String processDefId,String activityDefId) throws WorkFlowException;

	/**
	 * 获取流程配置列表
	 * @param params
	 * @return
	 * @throws WorkFlowException
	 */
	public Page<List<ProcessInfoConfig>> findProcessInfoConfigsPage(ProcessInfoConfig params) throws WorkFlowException;
	
	public List<String> getAllProcessIdForExport(ProcessInfoConfig params);
	/**
	 * 获取流程配置列表
	 * @param params
	 * @return
	 * @throws WorkFlowException
	 */
	public List<ProcessInfoConfig> findProcessInfoConfigs(ProcessInfoConfig params) throws WorkFlowException;
	public  ActivityInfoConfig getActivityInfoConfig(String processDefId,String activityDefId) throws WorkFlowException;
	/**
	 * 获取流程环节配置
	 * @param processDefId
	 * @param activityDefId
	 * @param opScope
	 * @param pageDetailVaribale
	 * @return
	 * @throws WorkFlowException
	 */
	public ActivityInfoConfig getActivityInfoConfig(String processDefId,String activityDefId,String opScope,Map pageDetailVaribale) throws WorkFlowException;
	/**
	 * 获取流程环节配置
	 * @param processDefId
	 * @param activityDefId
	 * @param opScope
	 * @param pageDetailVaribale
	 * @return
	 * @throws WorkFlowException
	 */
	public ActivityInfoConfig getActivityInfoConfigByLocal(String processDefId,
			String activityDefId);
	/**
	 * 获取流程配置
	 * @param processDefId
	 * @return
	 * @throws WorkFlowException
	 */
	public ProcessInfoConfig getProcessInfoConfig(String processDefId) throws WorkFlowException;
	/**
	 * 删除流程配置
	 * @param processDefId
	 * @return
	 * @throws WorkFlowException
	 */
	public boolean deleteProcessInfoConfig(String processDefId) throws WorkFlowException;
	/**
	 * 导出一个流程数据
	 * @param processDefId
	 * @return
	 */
	public ByteArrayOutputStream exportOneProcessData(String processDefId);
	/**
	 * 导入一个流程数据
	 * @param fileContent
	 * @param importType
	 * @return
	 */
	public ServiceResponse<Void> importOneProcessData(String proceDefId,String tenantId,String deploymentId,String fileContent,
			String importType);
	/**
	 * 判断是否流程贯彻流程
	 * @param processDefId
	 * @param activityDefId
	 * @return
	 */
	public  boolean isThroughBizAppProcess(String processDefId, String activityDefId);
	/**
	 * 判断流程按钮是否有权限操作,如当前流程、待办是否有退回上一步、作废等操作权限
	 * @param butOperateId
	 * @param pageDetailVaribale
	 * @return
	 */
	public boolean hasActivityButOperatePower(String butOperateId, Map<String,Object> pageDetailVaribale);
	
	
	/**
	 * 导出某个应用下所有角色
	 * @param appId
	 * @return
	 */
	public ByteArrayOutputStream exportAllRoleData(String appId);
	
	
	/**
	 * 导入某个应用下所有角色
	 * @param fileContent
	 * @return
	 */
	public void importAllRoleData(String fileContent) ;
	
	/**
	 * 
	 * @param processInstanceId
	 * @param taskId
	 * @return
	 */
	public List<String> getPreTaskAssignee(String processInstanceId, String taskId) ;
	
	/**
	 * 获取流程配置和模型列表
	 * @param params
	 * @return
	 * @throws WorkFlowException
	 */
	public Page<List<ProcessInfoConfig>> findProcessConfigAndModel(ProcessInfoConfig params) throws WorkFlowException;
}
