/*
 * @Author: 赵伟
 * @Date: 2024-11-18 10:18:27
 * @Description: 超参数自动寻优请求
 */

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

// 分页查询超参数自动寻优
export function getRayListReq(params, skipLoading) {
  return request(`/api/mmp/ray`, {
    method: 'GET',
    params,
    skipLoading
  });
}

// 查询超参数自动寻优详情
export function getRayInfoReq(params) {
  return request(`/api/mmp/ray/getRayDetail`, {
    method: 'GET',
    params,
  });
}

// 新增超参数自动寻优
export function addRayReq(data) {
  return request(`/api/mmp/ray`, {
    method: 'POST',
    data,
  });
}

// 编辑超参数自动寻优
export function updateRayReq(data) {
  return request(`/api/mmp/ray`, {
    method: 'PUT',
    data,
  });
}

// 删除超参数自动寻优
export function deleteRayReq(id) {
  return request(`/api/mmp/ray/${id}`, {
    method: 'DELETE',
  });
}

// 运行超参数自动寻优
export function runRayReq(id) {
  return request(`/api/mmp/ray/run/${id}`, {
    method: 'POST',
  });
}

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

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

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

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

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

// 获取当前实验的指标对比地址
export function getExpMetricsReq(data) {
  return request(`/api/mmp/rayIns/getExpMetrics`, {
    method: 'POST',
    data,
  });
}


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