import request from '@/config/axios'

// 问卷 VO
export interface QuestionnaireVO {
  id: number // id
  bqQuestionnaire: string // 问卷名称
  bqDetails: string // 问卷介绍
  bqOrder: number // 问卷排序
  bqStartInfo: string // 问卷开始指导语
  bqEndInfo: string // 问卷结束指导语
  bqQuestIds: string // 问题id集
  tenantId: Number // 租户id
}
// 课程-试题 VO
export interface CourseQuestionVO {
  questionnaireId: number // 试卷id
  cqQuestion: string // 试题内容
  cqQuestType: string // 试题类型
  tenantId: undefined,
}

// 问卷 API
export const QuestionnaireApi = {
  // 查询问卷分页
  getQuestionnairePage: async (params: any) => {
    return await request.get({ url: `/bjdx/questionnaire/page`, params })
  },

  // 查询问卷详情
  getQuestionnaire: async (id: number) => {
    return await request.get({ url: `/bjdx/questionnaire/get?id=` + id })
  },

  // 新增问卷
  createQuestionnaire: async (data: QuestionnaireVO) => {
    return await request.post({ url: `/bjdx/questionnaire/create`, data })
  },

  // 修改问卷
  updateQuestionnaire: async (data: QuestionnaireVO) => {
    return await request.put({ url: `/bjdx/questionnaire/update`, data })
  },

  // 删除问卷
  deleteQuestionnaire: async (id: number) => {
    return await request.delete({ url: `/bjdx/questionnaire/delete?id=` + id })
  },

  // 导出问卷 Excel
  exportQuestionnaire: async (params) => {
    return await request.download({ url: `/bjdx/questionnaire/export-excel`, params })
  },

  // 查询问卷配置
  getConfigQuest: async (params: any) => {
    return await request.get({ url: `/bjdx/questionnaire/getConfigQuest`, params })
  },

  // 查询问卷配置
  getConfigQuestNo: async (params: any) => {
    return await request.get({ url: `/bjdx/questionnaire/getConfigQuestNo`, params })
  },

  // 查询问卷配置
  addConfigQuest: async (params: any) => {
    return await request.get({ url: `/bjdx/questionnaire/addConfigQuest`, params })
  },

  // 查询问卷配置
  delConfigQuest: async (params: any) => {
    return await request.get({ url: `/bjdx/questionnaire/delConfigQuest`, params })
  },
}
