import httpRequest from '@/utils/axios'

// 我的数据集列表
export function getMyList(params?: Partial<{ page: number; 'per-page': number }>) {
  return httpRequest.get('/api/resource/bi/v1/data/my/list', { params })
}

// 查看字段详情
export function getMyField() {
  return httpRequest.get('/api/resource/bi/v1/data/my/field-detail')
}

// 进度查询
export function getProcessProgress(params: { function_name: string }) {
  return httpRequest.get('/api/resource/bi/v1/processing/processing/progress', { params })
}

// 数据可视化组件列表
export function getChartComponentList(params?: Partial<{ page: number; 'per-page': number; type: string }>) {
  return httpRequest.get('/api/resource/bi/v1/reporting/component/list', { params })
}

// 更新数据可视化组件
export function createChartComponent(data: { name: string; type: string; content: string }) {
  return httpRequest.post('/api/resource/bi/v1/reporting/component/create', data)
}

// 更新数据可视化组件
export function updateChartComponent(data: { id: string; name: string; type: string; content: string }) {
  return httpRequest.post('/api/resource/bi/v1/reporting/component/update', data)
}

// 删除数据可视化组件
export function deleteChartComponent(data: { id: string }) {
  return httpRequest.post('/api/resource/bi/v1/reporting/component/delete', data)
}

// 数据可视化组件详情
export function getChartComponent(params: { id: string }) {
  return httpRequest.get('/api/resource/bi/v1/reporting/component/view', { params })
}
