import request from '@/utils/request'

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

// 查询规则引擎详细
export function getRuleengine(id) {
  return request({
    url: '/ruleengine/ruleengine/' + id,
    method: 'get'
  })
}

export function ruleengine(content) {
  return request({
    url: `/ruleengine/ruleengine/compiler`,
    method: 'post',
    data:content
  })
}

export function getRuleContent(ruleId) {
  return request({
    url: `/ruleengine/ruleengine/getRuleContent?ruleId=`+ruleId,
    method: 'get'
  })
}

export function loader() {
  return request({
    url: `/ruleengine/ruleengine/loader`,
    method: 'get'
  })
}


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

// 修改规则引擎
export function updateRuleengine(data) {
  return request({
    url: '/ruleengine/ruleengine/'+data.id,
    method: 'put',
    data: data
  })
}

// 删除规则引擎
export function delRuleengine(id) {
  return request({
    url: '/ruleengine/ruleengine/' + id,
    method: 'delete'
  })
}

export function findRuleEngineById(id) {
  return request({
    url: '/ruleengine/ruleengine/findRuleEngineById?id='+id,
    method: 'post',
    params:id,
  })
}

export function addEngineversion(data){
  return request({
    url: '/ruleengine/ruleengine/addEngineversion',
    method: 'post',
    data:data,
  })
}

export function updateRuleActivate(data){
  return request({
    url: '/ruleengine/ruleengine/updateRuleActivate',
    method: 'post',
    data:data,
  })
}

export function updateRuleStatus(data){
  return request({
    url: '/ruleengine/ruleengine/updateRuleStatus',
    method: 'post',
    data:data,
  })
}

export function updateEngineCodeIng(data){
  return request({
    url: '/ruleengine/ruleengine/updateEngineCodeIng',
    method: 'post',
    data:data,
  })
}

export function engineGeneration(codeIng){
  return request({
    url: '/ruleengine/ruleengine/engineGeneration',
    method: 'get',
    params:codeIng,
  })
}

