import request from '@/config/axios'

export interface TaskCommentVO {
  id: number
  userId: number
  userNickname: string
  userAvatar: string
  anonymous: boolean
  taskRecordId: number
  productId: number
  productName: string
  visible: boolean
  scores: number
  content: string
  picUrls: object
  replyStatus: boolean
  replyUserId: number
  replyContent: string
  replyTime: Date
}

// 查询任务评论列表
export const getTaskCommentPage = async (params) => {
  return await request.get({ url: `/member/task-comment/page`, params })
}

// 查询任务评论详情
export const getTaskComment = async (id: number) => {
  return await request.get({ url: `/member/task-comment/get?id=` + id })
}

// 新增任务评论
export const createTaskComment = async (data: TaskCommentVO) => {
  return await request.post({ url: `/member/task-comment/create`, data })
}

// 修改任务评论
export const updateTaskComment = async (data: TaskCommentVO) => {
  return await request.put({ url: `/member/task-comment/update`, data })
}

// 删除任务评论
export const deleteTaskComment = async (id: number) => {
  return await request.delete({ url: `/member/task-comment/delete?id=` + id })
}

// 导出任务评论 Excel
export const exportTaskComment = async (params) => {
  return await request.download({ url: `/member/task-comment/export-excel`, params })
}
