import request from '@/utils/request'

// 查询校验规则配置列表
export function listValidation(query) {
  return request({
    url: '/business/validation/list',
    method: 'get',
    params: query
  })
}


// 新增校验规则配置
export function testFormulaValidation(data) {
  return request({
    url: '/business/validation/testFormula',
    method: 'post',
    data: data
  })
}

export function saveOrUpdateValidation(data) {
  return request({
    url: '/business/validation/saveOrUpdate',
    method: 'post',
    data: data
  })
}

export function getInfoByIdValidation(data) {
  return request({
    url: '/business/validation/getInfoById/' + data,
    method: 'get',
  })
}

export function getRelationByIdValidation(data) {
  return request({
    url: '/business/validation/initRelation',
    method: 'get',
    params: data
  })
}

export function batchChangeRelation(data) {
  return request({
    url: '/business/validation/batchChangeRelation',
    method: 'post',
    data
  })
}


export function deleteValidation(data) {
  return request({
    url: '/business/validation/delete',
    method: 'delete',
    params: data
  })
}

export function changeValidationStatus(data) {
  return request({
    url: '/business/validation/changeStatus',
    method: 'post',
    data: data
  })
}


export function getCommonParamList() {
  return request({
    url: '/business/commonParam/getCommonList',
    method: 'get',
  })
}

// 电梯配置参数验证
export function checkElevatorParam(data) {
  return request({
    url: '/business/validation/elevator/check',
    method: 'post',
    data: data
  })
}

// 参数联动结果计算
export function computeResult(data) {
  return request({
    url: '/business/validation/compute/' + Math.round(Math.random() * 100000000),
    method: 'post',
    data: data
  })
}

