import request from '@/utils/request'

// ── 元数据 ────────────────────────────────────────────────────────────────────
export function getMonitorModels() {
  return request.get('/monitor/models')
}

export function getMonitorPackages() {
  return request.get('/monitor/packages')
}

// ── 试验 CRUD ─────────────────────────────────────────────────────────────────
export function getExperiments() {
  return request.get('/monitor/experiments')
}

export function createExperiment(payload) {
  return request.post('/monitor/experiments', payload)
}

export function getExperiment(expId) {
  return request.get(`/monitor/experiments/${expId}`)
}

export function deleteExperiment(expId) {
  return request.delete(`/monitor/experiments/${expId}`)
}

// ── 控制操作 ──────────────────────────────────────────────────────────────────
export function startExperiment(expId) {
  return request.post(`/monitor/experiments/${expId}/start`)
}

export function stopExperiment(expId) {
  return request.post(`/monitor/experiments/${expId}/stop`)
}

// ── 数据 / 报告 / 导出 ────────────────────────────────────────────────────────
export function getDataPoints(expId, fromStep = 0) {
  return request.get(`/monitor/experiments/${expId}/data`, { params: { from_step: fromStep } })
}


