import request from '@/utils/request'

// 查询试卷管理列表
export function listPaper(query) {
  return request({
    url: '/exam/paper/list',
    method: 'get',
    params: query
  })
}

// 查询试卷管理列表(不分页)
export function listPaperAll(query) {
  return request({
    url: '/exam/paper/listAll',
    method: 'get',
    params: query
  })
}

// 查询试卷管理详细
export function getPaper(id) {
  return request({
    url: '/exam/paper/' + id,
    method: 'get'
  })
}

// 新增试卷管理
export function addPaper(data) {
  return request({
    url: '/exam/paper',
    method: 'post',
    data: data
  })
}

// 修改试卷管理
export function updatePaper(data) {
  return request({
    url: '/exam/paper',
    method: 'put',
    data: data
  })
}

// 删除试卷管理
export function delPaper(id) {
  return request({
    url: '/exam/paper/' + id,
    method: 'delete'
  })
}

// 组卷
export function createPaper(data) {
  return request({
    url: '/exam/paper/create-paper',
    method: 'post',
    data: data
  })
}

// 开始考试
export function paperId(id) {
  return request({
    url: '/exam/paper/'+id,
    method: 'get',
  })
}

// 查询问题和选项
export function paperDetail(data) {
  return request({
    url: '/exam/paper/paperDetail',
    method: 'post',
    data: data
  })
}

// 保存用户答案
export function fillAnswer(data) {
  return request({
    url: '/exam/paper/fillAnswer',
    method: 'post',
    data: data
  })
}

// 交卷
export function handPaper(data) {
  return request({
    url: '/exam/paper/handPaper',
    method: 'post',
    data: data
  })
}

//查询考试结果
export function paperResult(data) {
  return request({
    url: '/exam/paper/paperResult',
    method: 'post',
    data: data
  })
}
