import request from '@/utils/request'

// 查询规则引擎列表
export function listEngine(query) {
  return request({
    url: '/rule/engine/list',
    method: 'get',
    params: query
  })
}

// 查询规则引擎详细
export function getEngine(ruleId) {
  return request({
    url: '/rule/engine/' + ruleId,
    method: 'get'
  })
}

// 新增规则引擎
export function addEngine(data) {
  return request({
    url: '/rule/engine',
    method: 'post',
    data: data
  })
}

// 修改规则引擎
export function updateEngine(data) {
  return request({
    url: '/rule/engine',
    method: 'put',
    data: data
  })
}

// 删除规则引擎
export function delEngine(ruleId) {
  return request({
    url: '/rule/engine/' + ruleId,
    method: 'delete'
  })
}

export function selectRuleEngineByRuleId(ruleId) {
  return request({
    url: '/rule/engine/' + ruleId,
    method: 'get'
  })
}

export function description(ruleId) {
  return request({
    url: '/rule/engine/description/' + ruleId,
    method: 'post'
  })
}

export function selectRuleEngineOne(ruleId) {
  return request({
    url: '/rule/engine/selectRuleEngineOne/' + ruleId,
    method: 'post'
  })
}

export function updateRuleIsActivate(data) {
  return request({
    url: '/rule/engine/updateRuleIsActivate',
    method: 'put',
    data: data
  })
}

export function updateRuleStatus(data) {
  return request({
    url: '/rule/engine/updateRuleStatus',
    method: 'put',
    data: data
  })
}

export function spliceNameToCode(name, code, level) {
  return request({
    url: '/rule/engine/spliceNameToCode?name=' + name + "&code=" + code + "&level=" + level,
    method: 'post'
  })
}

