import axios from 'axios';

// 公共路径
const urlPrefix = '/api/v1/bpms-workbench';

// 提交环境配置信息
export function submitEnvConfig(params) {
  return axios.post(`${urlPrefix}/componentDeployEnv/submit`, params);
}

// 环境配置列表
export function getEnvConfigList(params) {
  return axios.get(`${urlPrefix}/componentDeployEnv/page`, { params });
}

// 删除环境配置
export function deleteEnvConfig(id: string) {
  return axios.post(`${urlPrefix}/componentDeployEnv/remove?id=${id}`);
}

// 下载环境配置文件
export function downloadEnvConfigFile(id: string) {
  return axios.post(`${urlPrefix}/componentDeployEnv/download`, { id },{ responseType: 'blob' });
}

// 环境测试
export function testEnv(id: string) {
  return axios.get(`${urlPrefix}/componentDeployEnv/check?id=${id}`);
}

// 主机列表
export function getHostList(params) {
  return axios.get(`${urlPrefix}/componentDeployEnv/list`, { params });
}