import request from '@/config/axios'

export interface LevelConfigVO {
  id: number
  level: number
  displayName: string
  taskLimit: number
  commissionRate: number
  minimumWithdrawalAmount: number
  price: number
  teamMembers: number
  activeTeamMembers: number
  description: string
}

// 查询会员级别列表
export const getLevelConfigPage = async (params) => {
  return await request.get({ url: `/member/level-config/page`, params })
}

// 查询会员级别详情
export const getLevelConfig = async (id: number) => {
  return await request.get({ url: `/member/level-config/get?id=` + id })
}

// 新增会员级别
export const createLevelConfig = async (data: LevelConfigVO) => {
  return await request.post({ url: `/member/level-config/create`, data })
}

// 修改会员级别
export const updateLevelConfig = async (data: LevelConfigVO) => {
  return await request.put({ url: `/member/level-config/update`, data })
}

// 删除会员级别
export const deleteLevelConfig = async (id: number) => {
  return await request.delete({ url: `/member/level-config/delete?id=` + id })
}

// 导出会员级别 Excel
export const exportLevelConfig = async (params) => {
  return await request.download({ url: `/member/level-config/export-excel`, params })
}
