import request from '@/config/axios'

// 课程配置 VO
export interface CourseConfigVO {
  id: number // 课程配置id
  ccCourseId: number // 课程id
  courseName: string // 课程名称
  ccTime: number // 课程暂停时长
  ccQuestId: number // 试题id
  questContent: string // 试题内容
  ccAnswerJudge: string // 是否显示答案, // 选择的试题id
  ccQuestSource: undefined // 问题呈现类型
  ccQuestContent: undefined  // 问题内容
  ccQuestOption: undefined  // 问题选项
  ccAiAnswer: undefined  // AI答案
  ccAnswer: undefined  // 答案
  tenantId: Number // 租户id
}

// 课程配置 API
export const CourseConfigApi = {
  // 查询课程配置分页
  getCourseConfigPage: async (params: any) => {
    return await request.get({ url: `/bjdx/course-config/page`, params })
  },

  // 查询课程配置详情
  getCourseConfig: async (id: number) => {
    return await request.get({ url: `/bjdx/course-config/get?id=` + id })
  },

  // 查询课程配置试题详情
  getCourseConfigQuestion: async (ccCourseId: number) => {
    return await request.get({ url: `/bjdx/course-config/getConfigQuest?ccCourseId=` + ccCourseId })
  },

  // 新增课程配置
  createCourseConfig: async (data: CourseConfigVO) => {
    return await request.post({ url: `/bjdx/course-config/create`, data })
  },

  // 修改课程配置
  updateCourseConfig: async (data: CourseConfigVO) => {
    return await request.put({ url: `/bjdx/course-config/update`, data })
  },

  // 删除课程配置
  deleteCourseConfig: async (id: number) => {
    return await request.delete({ url: `/bjdx/course-config/delete?id=` + id })
  },

  // 导出课程配置 Excel
  exportCourseConfig: async (params) => {
    return await request.download({ url: `/bjdx/course-config/export-excel`, params })
  }
}
