import httpRequest from '@/utils/axios'
import type { LabelTypeListRequest, LabelTypeCreateRequest, LabelTypeUpdateRequest, LabelListRequest, LabelCreateRequest, LabelUpdateRequest } from './types'

// 获取标签类型列表
export function getLabelTypeList(params?: LabelTypeListRequest) {
  return httpRequest.get('/api/lab/v1/experiment/tag-type/bda-list', { params })
}

// 创建标签类型
export function createLabelType(data: LabelTypeCreateRequest) {
  return httpRequest.post('/api/lab/v1/experiment/tag-type/create', data)
}

// 更新标签类型
export function updateLabelType(data: LabelTypeUpdateRequest) {
  return httpRequest.post('/api/lab/v1/experiment/tag-type/update', data)
}

// 更新标签类型
export function deleteLabelType(data: { id: string }) {
  return httpRequest.post('/api/lab/v1/experiment/tag-type/delete', data)
}

// 获取标签列表
export function getLabelList(params?: LabelListRequest) {
  return httpRequest.get('/api/lab/v1/experiment/tag/bda-list', { params })
}

// 创建标签
export function createLabel(data: LabelCreateRequest) {
  return httpRequest.post('/api/lab/v1/experiment/tag/bda-create', data)
}

// 更新标签
export function updateLabel(data: LabelUpdateRequest) {
  return httpRequest.post('/api/lab/v1/experiment/tag/bda-update', data)
}

// 删除标签
export function deleteLabel(data: { id: string }) {
  return httpRequest.post('/api/lab/v1/experiment/tag/bda-delete', data)
}

// 删除标签
export function deleteLabels(data: { ids: string }) {
  return httpRequest.post('/api/lab/v1/experiment/tag/batch-delete', data)
}

// 获取标签数据信息
export function getLabelStatistics(params: { id: string }) {
  return httpRequest.get('/api/lab/v1/experiment/tag/bda-statistics', { params })
}

// 更新标签数据信息
export function updateLabelStatistics(data: { id: string }) {
  return httpRequest.post('/api/lab/v1/experiment/tag/bda-statistics-user-tag', data)
}

// 获取标签规则
export function getLabelRule(params: { id: string }) {
  return httpRequest.get('/api/lab/v1/experiment/tag/bda-rules', { params })
}

// 更新标签规则
export function updateLabelRule(data: { id: string; rules: string }) {
  return httpRequest.post('/api/lab/v1/experiment/tag/bda-save-rules', data)
}

// 获取标签成员
export function getLabelMembers(params: { tag_id: string }) {
  return httpRequest.get('/api/lab/v1/experiment/tag/bda-statistics-users', { params })
}
