/*
 * @Author: 赵伟
 * @Date: 2024-11-18 10:18:27
 * @Description: 自动机器学习请求
 */

import { request } from '@umijs/max';

// 分页查询自动学习
export function getAutoMLListReq(params, skipLoading) {
  return request(`/api/mmp/machineLearn`, {
    method: 'GET',
    params,
    skipLoading,
  });
}

// 查询自动学习详情
export function getAutoMLInfoReq(params) {
  return request(`/api/mmp/machineLearn/getMLDetail`, {
    method: 'GET',
    params,
  });
}

// 新增自动学习
export function addAutoMLReq(data) {
  return request(`/api/mmp/machineLearn`, {
    method: 'POST',
    data,
  });
}

// 编辑自动学习
export function updateAutoMLReq(data) {
  return request(`/api/mmp/machineLearn`, {
    method: 'PUT',
    data,
  });
}

// 删除自动学习
export function deleteAutoMLReq(id) {
  return request(`/api/mmp/machineLearn/${id}`, {
    method: 'DELETE',
  });
}

// 运行自动学习
export function runAutoMLReq(id) {
  return request(`/api/mmp/machineLearn/run/${id}`, {
    method: 'POST',
  });
}

// ----------------------- 实验实例 -----------------------
// 获取实验实例列表
export function getExperimentInsListReq(params, skipLoading) {
  return request(`/api/mmp/machineLearnIns`, {
    method: 'GET',
    params,
    skipLoading,
  });
}

// 查询实验实例详情
export function getExperimentInsReq(id) {
  return request(`/api/mmp/machineLearnIns/${id}`, {
    method: 'GET',
  });
}

// 停止实验实例
export function stopExperimentInsReq(id) {
  return request(`/api/mmp/machineLearnIns/${id}`, {
    method: 'PUT',
  });
}

// 删除实验实例
export function deleteExperimentInsReq(id) {
  return request(`/api/mmp/machineLearnIns/${id}`, {
    method: 'DELETE',
  });
}

// 批量删除实验实例
export function batchDeleteExperimentInsReq(data) {
  return request(`/api/mmp/machineLearnIns/batchDelete`, {
    method: 'DELETE',
    data,
  });
}

// 编辑实验实例
export function editExperimentInsReq(data) {
  return request(`/api/mmp/machineLearnIns`, {
    method: 'PUT',
    data,
    skipLoading: true,
  });
}
