import request from '@/utils/request'

// 查询我的任务列表（当天有效任务）
export function getMyTasks(params) {
  return request({
    url: '/exam/daily/task/my-tasks-today',
    method: 'get',
    params: params
  })
}

// 查询今日是否有待完成任务
export function hasPendingTask() {
  return request({
    url: '/exam/daily/task/has-pending-task',
    method: 'get'
  })
}

// 查询任务详情
export function getTaskDetail(taskId) {
  return request({
    url: `/exam/daily/task/${taskId}`,
    method: 'get'
  })
}

// 开始答题
export function startTask(taskId) {
  return request({
    url: `/exam/daily/task/start/${taskId}`,
    method: 'post'
  })
}

// 提交答案
export function submitAnswer(data) {
  return request({
    url: '/exam/daily/task/submit',
    method: 'post',
    data: data
  })
}

// 获取任务剩余时间
export function getRemainingTime(taskId) {
  return request({
    url: `/exam/daily/task/remaining-time/${taskId}`,
    method: 'get'
  })
}

// 获取我的统计数据
export function getMyStatistics() {
  return request({
    url: '/exam/daily/statistics/my-statistics',
    method: 'get'
  })
}

// 获取我的薄弱模块
export function getWeakModules() {
  return request({
    url: '/exam/daily/statistics/weak-modules',
    method: 'get'
  })
}

//已完成任务列表
export function getCompletedTasks(params) {
  return request({
    url: '/exam/daily/task/my-tasks-completed',
    method: 'get',
    params: params
  })
}

//已过期任务列表
export function getExpiredTasks(params) {
  return request({
    url: '/exam/daily/task/my-tasks-expired',
    method: 'get',
    params: params
  })
}

//全部任务列表
export function getAllTasks(params) {
  return request({
    url: '/exam/daily/task/my-tasks',
    method: 'get',
    params: params
  })
}

//待考试任务列表
export function getPendingTasks(params) {
  return request({
    url: '/exam/daily/task/my-tasks-today',
    method: 'get',
    params: params
  })
}
