import request from '@/config/axios'

// 获取积分规则配置列表
export const getPointRuleConfigPage = async (params) => {
  return await request.get({ 
    url: '/menduner/reward/point-rule-config/page',
    params
  })
}

// 获取积分配置详情
export const getPointRuleConfigDetails = async (id) => {
  return await request.get({ 
    url: `/menduner/reward/point-rule-config/get?id=${id}`
  })
}

// 删除积分规则配置
export const deletePointRuleConfig = async (id) => {
  return await request.delete({ 
    url: `/menduner/reward/point-rule-config/delete?id=${id}`
  })
}

// 创建积分规则配置
export const savePointRuleConfig = async (data) => {
  return await request.post({ 
    url: '/menduner/reward/point-rule-config/create',
    data
  })
}

// 更新积分规则配置
export const updatePointRuleConfig = async (data) => {
  return await request.put({ 
    url: '/menduner/reward/point-rule-config/update',
    data
  })
}

// 获取事件地址列表
export const getEventTrackUrlList = async () => {
  return await request.get({ 
    url: '/menduner/reward/event-track/get/url/list'
  })
}

// 获取操作运算符列表
export const getOperationList = async () => {
  return await request.get({ 
    url: '/menduner/reward/common/get/operation'
  })
}

// 获取事件指标列表
export const getEventIndicatorList = async () => {
  return await request.get({ 
    url: '/menduner/reward/event-metric/list'
  })
}

// 导出积分规则配置表
export const pointRuleConfigDownload = async (params) => {
  return await request.download({ url: `/menduner/reward/point-rule-config/export-excel`, params })
}

// 关闭规则
export const closeRoleConfig = async (ids) => {
  return await request.post({ 
    url: `/menduner/reward/point-rule-config/disable?ids=${ids}`
  })
}

// 开启规则
export const openRoleConfig = async (ids) => {
  return await request.post({ 
    url: `/menduner/reward/point-rule-config/enable?ids=${ids}`
  })
}