import request from '@/utils/request'

export function getElectiveStatus(params) {
  return request({
    url: '/front/elective/generation/getElectiveStatus',
    method: 'get',
    params
  })
}

export function getElectiveSummary(params) {
  return request({
    url: '/front/elective/generation/getElectiveSummary',
    method: 'get',
    params
  })
}

export function getElectiveGenerationDetails(params) {
  return request({
    url: '/front/elective/generation/getElectiveGenerationDetails',
    method: 'get',
    params
  })
}

export function getGenerationOptionalMajorsBatch(params) {
  return request({
    url: '/front/elective/generation/getGenerationOptionalMajorsBatch',
    method: 'get',
    params
  })
}

// /prod-api/front/elective/generation/applyElectiveDMAlgorithm
// 执行选科匹配算法。为减少错误，对DM代数据全删全加可能好点。
export function applyElectiveDMAlgorithm(algorithm) {
  return request({
    url: '/front/elective/generation/applyElectiveDMAlgorithm?algorithm=' + algorithm,
    method: 'post'
  })
}

// /prod-api/front/elective/generation/cancelEnrollByForce
// 取消强制调剂操作
export function cancelEnrollByForce(id) {
  return request({
    url: '/front/elective/generation/cancelEnrollByForce?id=' + id,
    method: 'post'
  })
}

// /front/elective/generation/enrollByForce
// 决策阶段，强制调剂录取
export function enrollByForce(groupId, studentId) {
  return request({
    url: '/front/elective/generation/enrollByForce?groupId=' + groupId + '&studentId=' + studentId,
    method: 'post'
  })
}

// /front/elective/generation/flushIntoGenerationDM
// 在任意报名阶段，如果校长发现数据已经完全OK，则可以强制推进进程，提前进入决策
export function flushIntoGenerationDM() {
  return request({
    url: '/front/elective/generation/flushIntoGenerationDM',
    method: 'post'
  })
}

// /front/elective/generation/jumpGenerationForceAdjust
// 二次补录结果（或者提前录取完毕时）跳转到强制调剂
export function jumpGenerationForceAdjust() {
  return request({
    url: '/front/elective/generation/jumpGenerationForceAdjust',
    method: 'post'
  })
}

// /front/elective/generation/jumpGenerationRankBalance
// 如果在所有学生全部录取的情况，可以在任意决策结点跳转至排名均衡
export function jumpGenerationRankBalance() {
  return request({
    url: '/front/elective/generation/jumpGenerationRankBalance',
    method: 'post'
  })
}

// /prod-api/front/elective/generation/pushGenerationSetting
// 决策完毕时，推进下一代进行
export function pushGenerationSetting(data) {
  return request({
    url: '/front/elective/generation/pushGenerationSetting',
    method: 'post',
    data
  })
}

// /front/elective/generation/terminateGeneration
// 如果在所有学生全部录取的情况，可以在任意决策结点跳转至终止态，封存数据
export function terminateGeneration() {
  return request({
    url: '/front/elective/generation/terminateGeneration',
    method: 'post'
  })
}
