/*
 * @Author: 赵伟
 * @Date: 2025-01-08 14:30:58
 * @Description: 实验列表组件配置
 */

import {
  batchDeleteExperimentInsReq,
  deleteAutoMLReq,
  deleteExperimentInsReq,
  getAutoMLListReq,
  getExperimentInsListReq,
  runAutoMLReq,
  stopExperimentInsReq,
} from '@/services/autoML';
import {
  batchDeleteRayInsReq,
  deleteRayInsReq,
  deleteRayReq,
  getRayInsListReq,
  getRayListReq,
  runRayReq,
  stopRayInsReq,
} from '@/services/hyperParameter';

export enum ExperimentListType {
  AutoML = 'AutoML',
  HyperParameter = 'HyperParameter',
}

type ExperimentListInfo = {
  getListReq: (params: any) => Promise<any>; // 获取列表
  getInsListReq: (params: any) => Promise<any>; // 获取实例列表
  deleteRecordReq: (params: any) => Promise<any>; // 删除
  runRecordReq: (params: any) => Promise<any>; // 运行
  deleteInsReq: (params: any) => Promise<any>; // 删除实例
  batchDeleteInsReq: (params: any) => Promise<any>; // 批量删除实例
  stopInsReq: (params: any) => Promise<any>; // 终止实例
  title: string; // 标题
  pathPrefix: string; // 路由路径前缀
  idProperty: string; // ID属性
  nameProperty: string; // 名称属性
  descProperty: string; // 描述属性
};

export const experimentListConfig: Record<ExperimentListType, ExperimentListInfo> = {
  [ExperimentListType.AutoML]: {
    getListReq: getAutoMLListReq,
    getInsListReq: getExperimentInsListReq,
    deleteRecordReq: deleteAutoMLReq,
    runRecordReq: runAutoMLReq,
    deleteInsReq: deleteExperimentInsReq,
    batchDeleteInsReq: batchDeleteExperimentInsReq,
    stopInsReq: stopExperimentInsReq,
    title: '自主机器学习',
    pathPrefix: 'automl',
    nameProperty: 'ml_name',
    descProperty: 'ml_description',
    idProperty: 'autoMlId',
  },
  [ExperimentListType.HyperParameter]: {
    getListReq: getRayListReq,
    getInsListReq: getRayInsListReq,
    deleteRecordReq: deleteRayReq,
    runRecordReq: runRayReq,
    deleteInsReq: deleteRayInsReq,
    batchDeleteInsReq: batchDeleteRayInsReq,
    stopInsReq: stopRayInsReq,
    title: '超参数自动寻优',
    pathPrefix: 'hyperparameter',
    nameProperty: 'name',
    descProperty: 'description',
    idProperty: 'rayId',
  },
};
