import { del, get, post, put } from '../../http'

/**
 * @description: 获取功能介绍列表
 * @param {*} params
 * @return {*}
 */
export const getFunList = async (params: Record<string, any>) => {
  return await get<any>('/functionIntroduction/list', params)
}

/**
 * @description: 创建功能
 * @param {Record} params
 * @param {*} any
 */
export const createFun = async (data: Record<string, any>) => {
  return await post<any>('/functionIntroduction', data)
}

/**
 * @description: 更新功能
 * @param {Record} data
 * @param {*} any
 */
export const saveFun = async (data: Record<string, any>) => {
  return await put('/functionIntroduction', data)
}

/**
 * @description: 功能状态切换
 * @param {string} id
 */
export const funStatus = async (id: string) => {
  return await post<any>(`/functionIntroduction/changeStatus/${id}`)
}

/**
 * @description: 删除功能
 * @param {string} id
 */
export const funDelete = async (id: string) => {
  return await del(`/functionIntroduction/${id}`)
}

/**
 * @description: 查功能
 * @param {string} id
 */
export const getFun = async (id: string) => {
  return await get<any>(`/functionIntroduction/${id}`)
}

/**
 * @description: 兑换码组列表
 * @param {string}
 */
export const getRedeemCodeGroupList = async (params: Record<string, any>) => {
  return await get<any>('/redeemCodeGroup/list', params)
}

/**
 * @description: 更新兑换码组状态
 * @param {string}
 */
export const updateRedeemCodeGroupStatus = async (
  data: Record<string, any>,
) => {
  return await put('/redeemCodeGroup', data)
}

/**
 * @description: 新增兑换码组
 * @param {string}
 */
export const addRedeemCodeGroup = async (data: Record<string, any>) => {
  return await post<any>('/redeemCodeGroup/generateCode', data)
}

/**
 * @description: 兑换码列表
 * @param {string}
 */
export const getRedeemCodeList = async (params: Record<string, any>) => {
  return await get<any>('/redeemCode/list', params)
}
