import { http } from '@/http/http'

enum Api {
  base = '/examParticipant/participant',
  list = '/examParticipant/participant/list',
}

function getParticipantList(params: any) {
  return http.get(Api.list, params)
}

function getDetailParticipantList(params: any) {
  return http.get(`${Api.base}/detail-list`, params)
}

function startExam(id: number) {
  return http.post(
    `${Api.base}/start/${id}`,
    {},
  )
}

function endExam(id: number) {
  return http.post(
    `${Api.base}/end/${id}`,
    {},
  )
}

async function getParticipantById(id: number) {
  return http.get(`${Api.base}/${id}`)
}

async function deleteParticipant(id: number) {
  return http.delete(`${Api.base}/${id}`)
}

export {
  deleteParticipant,
  endExam,
  getDetailParticipantList,
  getParticipantById,
  getParticipantList,
  startExam,
}
