/*
 * @Author: 赵伟
 * @Date: 2024-03-25 13:52:54
 * @Description:
 */
import { request } from '@umijs/max';
// 查询流水线列表
export function getWorkflow(params) {
  return request(`/api/mmp/workflow`, {
    method: 'GET',
    params,
  });
}
// 新建流水线
export function addWorkflow(params) {
  return request('/api/mmp/workflow', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params,
  });
}
// 编辑流水线
export function editWorkflow(params) {
  return request('/api/mmp/workflow', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params,
  });
}
// 删除流水线
export async function removeWorkflow(id) {
  return request(`/api/mmp/workflow/${id}`, {
    method: 'DELETE',
  });
}
// 复制流水线
export function cloneWorkflow(id) {
  return request(`/api/mmp/workflow/duplicate/${id}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
  });
}
// 查询组件模型列表
export function getComponentAll() {
  return request(`/api/mmp/component/components/all`, {
    method: 'GET',
  });
}
// 保存流水线
export function saveWorkflow(params) {
  return request('/api/mmp/workflow', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params,
  });
}
// 根据id查询流水线
export function getWorkflowById(id) {
  return request(`/api/mmp/workflow/${id}`, {
    method: 'GET',
  });
}

// 获取资源规格
export function getComputingResourceReq(params) {
  return request(`/api/mmp/computingResource`, {
    method: 'GET',
    params,
  });
}
