import service from '@/utils/request'

// 获取支付配置列表
export const list = (params) => {
  return service({
    url: '/payConfig/list',
    method: 'get',
    params
  })
}

// 获取单个支付配置详情
export const detail = (id) => {
  return service({
    url: `/payConfig/${id}`,
    method: 'get'
  })
}

// 获取启用的支付配置（按编码）
export const getEnabled = (params) => {
  return service({
    url: '/payConfig/enabled',
    method: 'get',
    params
  })
}

// 创建支付配置
export const createPayConfig = (data) => {
  return service({
    url: '/payConfig',
    method: 'post',
    data
  })
}

// 更新支付配置
export const updatePayConfig = (data) => {
  return service({
    url: '/payConfig',
    method: 'put',
    data
  })
}

// 删除支付配置
export const removePayConfig = (id) => {
  return service({
    url: `/payConfig/${id}`,
    method: 'delete'
  })
}

// 切换启用状态
export const togglePayConfig = (data) => {
  return service({
    url: '/payConfig/toggle',
    method: 'post',
    data
  })
}

