import { get, post, put, del } from '../request'
import type { EvalTask, EvalTaskDetail, Dimension, StartEvalPayload } from '@/types'

/** 评测任务列表 */
export const getEvalList = () => get<EvalTask[]>('/model-eval')

/** 评测任务详情 */
export const getEvalDetail = (id: string | number) => get<EvalTaskDetail>(`/model-eval/${id}`)

/** 删除评测任务 */
export const deleteEval = (id: string | number) => del(`/model-eval/${id}`)

/** 启动评测 */
export const startEval = (data: StartEvalPayload) => post('/model-eval/start', data)

/** 评测维度列表 */
export const getDimensionList = () => get<Dimension[]>('/dimension')

/** 评测维度详情 */
export const getDimension = (id: string | number) => get<Dimension>(`/dimension/${id}`)

/** 创建维度 */
export const createDimension = (data: Partial<Dimension>) =>
  post<{ id: string | number }>('/dimension', data)

/** 编辑维度 */
export const updateDimension = (id: string | number, data: Partial<Dimension>) =>
  put(`/dimension/${id}`, data)

/** 删除维度 */
export const deleteDimension = (id: string | number) => del(`/dimension/${id}`)
