import request from '@/utils/request'

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

// 查询规则引擎详细
export function getEngine(id) {
  return request({
    url: '/rule_engine/engine/' + id,
    method: 'get'
  })
}
// 新增授权
export function permissionsUserAdd(data) {
  return request({
    url: '/rule_engine/permissionsUserAdd/' ,
    method: 'post',
    data
  })
}

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

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

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


// 加载
export function loading(data) {
  return request({
    url: '/rule_engine/engine/loading/' ,
    method: 'post',
    data
  })
}
// 加载
export function writeCodeAdd(data) {
  return request({
    url: '/rule_engine/engine/writeCodeAdd/' ,
    method: 'post',
    data
  })
}
// 获取规则引擎版本列表
export function selectRuleEngineVersion(id) {
  return request({
    url: '/rule_engine/engine/selectRuleEngineVersion?id='+id ,
    method: 'post'
  })
}
// 获取规则引擎是否激活
export function updateRuleEngineVersionIsActivate(data) {
  return request({
    url: '/rule_engine/engine/updateRuleEngineVersionIsActivate' ,
    method: 'post',
    data
  })
}// 获取规则引擎状态
export function updateRuleEngineVersionStates(data) {
  return request({
    url: '/rule_engine/engine/updateRuleEngineVersionStates' ,
    method: 'post',
    data
  })
}


// 添加规则引擎
export function ruleEngineVersionAdd(data) {
  return request({
    url: '/rule_engine/engine/RuleEngineVersionAdd' ,
    method: 'post',
    data
  })
}


// 保存代码
export function updataEngineVersionStatus(data) {
  return request({
    url: '/rule_engine/engine/updataEngineVersionStatus' ,
    method: 'post',
    data
  })
}


