import request from '@/config/axios'

export interface CustomTaskVO {
  id: number
  userId: number
  taskLimit: number
  updateCount: number
  effectDate: Date
  description: string
}

// 查询任务单数列表
export const getCustomTaskPage = async (params) => {
  return await request.get({ url: `/member/custom-task/page`, params })
}

// 查询任务单数详情
export const getCustomTask = async (id: number) => {
  return await request.get({ url: `/member/custom-task/get?id=` + id })
}

// 新增任务单数
export const createCustomTask = async (data: CustomTaskVO) => {
  return await request.post({ url: `/member/custom-task/create`, data })
}

// 修改任务单数
export const updateCustomTask = async (data: CustomTaskVO) => {
  return await request.put({ url: `/member/custom-task/update`, data })
}

// 删除任务单数
export const deleteCustomTask = async (id: number) => {
  return await request.delete({ url: `/member/custom-task/delete?id=` + id })
}

// 导出任务单数 Excel
export const exportCustomTask = async (params) => {
  return await request.download({ url: `/member/custom-task/export-excel`, params })
}

export const getCustomTaskByUserId = async (params) => {
  return await request.get({ url: `/member/custom-task/user`, params })
}
