package com.leanwo.activiti.rest.base;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.leanwo.activiti.dto.BaseResponse;
import com.leanwo.activiti.service.base.DeploymentVariableService;

@RestController
@RequestMapping("/workflow-prodog/DeploymentVariableResource")
public class DeploymentVariableResource {
	
	@Autowired
	private DeploymentVariableService deploymentVariableService;
	
	
	/**
	 * 新增流程部署变量
	 * @param deploymentId
	 * @param deploymentExtraDatas
	 * @return
	 */
	@RequestMapping(value = "/addDeploymentVariables", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
	public BaseResponse addDeploymentVariables(@RequestParam String deploymentId, @RequestBody Map<String, String> deploymentExtraDatas){
		return deploymentVariableService.addDeploymentVariables(deploymentId, deploymentExtraDatas);
	}
	
	/**
	 * 查询流程部署变量
	 * @param deploymentId
	 * @param variableNames 变量名称
	 * @return
	 */
	@RequestMapping(value = "/listDeploymentVariables", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
	public Map<String, String> listDeploymentVariables(@RequestParam String deploymentId, @RequestBody List<String> variableNames){
		return deploymentVariableService.listDeploymentVariables(deploymentId, variableNames);
	}
	
}
