import request from '@/utils/request'

/**
 * 查询开课计划列表
 * @param {Object} query 查询参数
 */
export function listCourseClass(query) {
  return request({
    url: '/education/courseClass/list',
    method: 'get',
    params: query
  })
}

/**
 * 查询开课计划详细
 * @param {Number} classId 开课计划ID
 */
export function getCourseClass(classId) {
  return request({
    url: '/education/courseClass/' + classId,
    method: 'get'
  })
}

/**
 * 新增开课计划
 * @param {Object} data 开课计划数据
 */
export function addCourseClass(data) {
  return request({
    url: '/education/courseClass',
    method: 'post',
    data: data
  })
}

/**
 * 修改开课计划
 * @param {Object} data 开课计划数据
 */
export function updateCourseClass(data) {
  return request({
    url: '/education/courseClass',
    method: 'put',
    data: data
  })
}

/**
 * 删除开课计划
 * @param {Array} classIds 开课计划ID数组
 */
export function delCourseClass(classIds) {
  return request({
    url: '/education/courseClass/' + classIds,
    method: 'delete'
  })
}

/**
 * 发布开课计划
 * @param {Number} classId 开课计划ID
 */
export function publishCourseClass(classId) {
  return request({
    url: '/education/courseClass/publish/' + classId,
    method: 'put'
  })
}

/**
 * 批量发布开课计划
 * @param {Array} classIds 开课计划ID数组
 */
export function batchPublishCourseClass(classIds) {
  return request({
    url: '/education/courseClass/batchPublish',
    method: 'put',
    data: classIds
  })
}

/**
 * 停止选课
 * @param {Number} classId 开课计划ID
 */
export function stopEnrollment(classId) {
  return request({
    url: '/education/courseClass/stopEnrollment/' + classId,
    method: 'put'
  })
}

/**
 * 结课
 * @param {Number} classId 开课计划ID
 */
export function finishCourse(classId) {
  return request({
    url: '/education/courseClass/finish/' + classId,
    method: 'put'
  })
}

/**
 * 调整容量
 * @param {Number} classId 开课计划ID
 * @param {Number} newCapacity 新容量
 */
export function adjustCapacity(classId, newCapacity) {
  return request({
    url: '/education/courseClass/adjustCapacity/' + classId + '/' + newCapacity,
    method: 'put'
  })
}

/**
 * 获取指定学期的开课计划
 * @param {Number} semesterId 学期ID
 */
export function getCourseClassBySemester(semesterId) {
  return request({
    url: '/education/courseClass/semester/' + semesterId,
    method: 'get'
  })
}

/**
 * 获取指定教师的开课计划
 * @param {Number} teacherId 教师ID
 */
export function getCourseClassByTeacher(teacherId) {
  return request({
    url: '/education/courseClass/teacher/' + teacherId,
    method: 'get'
  })
}

/**
 * 获取可选课的开课计划
 */
export function getEnrollableCourseClasses() {
  return request({
    url: '/education/courseClass/enrollable',
    method: 'get'
  })
}

/**
 * 获取开课计划统计信息
 * @param {Number} semesterId 学期ID
 */
export function getCourseClassStatistics(semesterId) {
  return request({
    url: '/education/courseClass/statistics/' + semesterId,
    method: 'get'
  })
}

/**
 * 导出开课计划
 * @param {Object} query 查询参数
 */
export function exportCourseClass(query) {
  return request({
    url: '/education/courseClass/export',
    method: 'post',
    params: query
  })
}