import request from '@/assets/js/utils/request'
import getUrl from '@/assets/js/utils/get-url'

/**
 * 获取所有的规则列表
 */
export function getRuleList(data = {}) {
  return request({
    url: getUrl('/rules/page'),
    method: 'post',
    data
  })
}

/**
 * 查看规则明细
 * @param {string} id - 规则id
 */
export function getRuleDetail(id) {
  return request({
    url: getUrl('/rulesEx/query'),
    method: 'get',
    params: { id }
  })
}

/**
 * 删除规则
 * @param {string[]} id - 规则id
 */
export function deleteRule(id) {
  return request({
    url: getUrl('/rules/delete'),
    method: 'post',
    data: id
  })
}

/**
 * 拆分规则新增
 */
export function addSplitRule(data) {
  return request({
    url: getUrl('/ruleDocSplitEx/create'),
    method: 'post',
    data
  })
}

/**
 * 拆分规则更新
 */
export function updateSplitRule(data) {
  return request({
    url: getUrl('/ruleDocSplitEx/update'),
    method: 'post',
    data
  })
}

/**
 * 提示词规则新增
 * @param {Object} data - 新增数据
 */
export function addPromptRule(data) {
  return request({
    url: getUrl('/ruleAttributeExtractEx/create'),
    method: 'post',
    data
  })
}

/**
 * 提示词规则更新
 * @param {Object} data - 更新数据
 */
export function updatePromptRule(data) {
  return request({
    url: getUrl('/ruleAttributeExtractEx/update'),
    method: 'post',
    data
  })
}
