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

// 参数类型定义
interface TaskConfigListParams {
  keyword?: string
  page?: number
  size?: number
  status?: string
  type?: string
}

interface TaskConfigData {
  description?: string
  id?: string
  name: string
  reward?: number
  status?: number
  type: string
}

/**
 * @description: 获取任务设置列表
 */
export const getTaskConfigList = async (params: TaskConfigListParams) => {
  return await get<any>('/taskConfig/list', params)
}

/**
 * @description: 更新任务设置
 */
export const updateTaskConfig = async (data: TaskConfigData) => {
  return await put('/taskConfig', data)
}
/**
 * @description: 删除任务设置
 * @param {string} id
 * @return {*}
 */
export const deleteTaskConfig = async (id: string) => {
  return await del(`/taskConfig/${id}`)
}
/**
 * @description: 新增任务设置
 */
export const addTaskConfig = async (data: TaskConfigData) => {
  return await post<any>('/taskConfig', data)
}
