import request from '@/utils/request'


//题库中心接口

// 教学阶段列表
export function pharseList() {
	return request({
		url: '/front/v2/pharse/list',
		method: 'get',
	})
}
// 课程列表
export function subjectList() {
	return request({
		url: '/front/v2/subject/list',
		method: 'get',
	})
}

// 试卷--课程列表
export function paperSubjectList() {
	return request({
		url: '/front/v2/papers/subjects',
		method: 'get',
	})
}
// 年级列表
export function gradeList(query) {
	return request({
		url: '/front/v2/grade/list',
		method: 'get',
		params: query
	})
}

// 版本列表
export function editionList(query) {
	return request({
		url: '/front/v2/edition/list',
		method: 'get',
		params: query
	})
}

// 排序后的--版本列表
export function newEditionList(query) {
	return request({
		url: '/front/v2/edition/listOrdered',
		method: 'get',
		params: query
	})
}

// 获得章节树
export function treeList(query) {
	return request({
		url: '/front/v2/chapterTree/list',
		method: 'get',
		params: query
	})
}
// 根据章节获取题库列表
export function listByChapter(query) {
	return request({
		url: '/front/v2/questions/listByChapter',
		method: 'get',
		params: query
	})
}


// 获取类型列表
export function papersTypes(query) {
	return request({
		url: '/front/v2/papers/types',
		method: 'get',
		params: query
	})
}
// 获取地区列表
export function papersAreas(query) {
	return request({
		url: '/front/v2/papers/areas',
		method: 'get',
		params: query
	})
}
// 获取试卷列表
export function papersList(query) {
	return request({
		url: '/front/v2/papers/list',
		method: 'get',
		params: query
	})
}

// 预览试卷
export function preview(query) {
	return request({
		url: '/front/v2/papers/preview',
		method: 'get',
		params: query
	})
}
// 收藏试卷
export function papersCollect(query) {
	let key = Object.keys(query)[0];
	let value = query[key];
	return request({
		url: '/front/v2/papers/collect?' + key + '=' + value,
		method: 'post',
	})
}
// 取消收藏试卷
export function papersCancelCollect(query) {
	return request({
		url: '/front/v2/papers/cancelCollect',
		method: 'post',
		params:query
	})
}

// 年份列表
export function papersYears(query) {
	return request({
		url: '/front/v2/papers/years',
		method: 'get',
		params: query
	})
}

// 根据科目查找题型  /front/v2/questions/listQuestionTypesBySubject
export function qtBySubject(query) {
	return request({
		url: '/front/v2/questions/listQuestionTypesBySubject',
		method: 'get',
		params: query
	})
}
//  获取知识点分类树
export function knowledgeTree(query) {
	return request({
		url: '/front/v2/knowledgeTree/list',
		method: 'get',
		params: query
	})
}

// 根据知识点获取题库列表
export function listByKnowledge(query) {
	return request({
		url: '/front/v2/questions/listByKnowledge',
		method: 'get',
		params: query
	})
}
// 根据章节获取题库类型和数量
export function countByChapter(query) {
	return request({
		url: '/front/v2/questions/countByChapter',
		method: 'get',
		params: query
	})
}

// 根据知识点获取题型数量
export function countByKnowledge(query) {
	return request({
		url: '/front/v2/questions/countByKnowledge',
		method: 'get',
		params: query
	})
}



// 根据章节获取题目数量
export function getQuestionsNumByChapter(query) {
	return request({
		url: '/front/v2/smartPractice/getQuestionsNumByChapter',
		method: 'get',
		params: query
	})
}
// 根据知识点获取题目数量
export function getQuestionsNumByKnowledge(query) {
	return request({
		url: '/front/v2/smartPractice/getQuestionsNumByKnowledge',
		method: 'get',
		params: query
	})
}


// 根据章节获取题目用来练习
export function getQuestionsByChapter(query) {
	return request({
		url: '/front/v2/smartPractice/getQuestionsByChapter',
		method: 'get',
		params: query
	})
}


// 根据知识点获取题目用来练习
export function getQuestionsByKnowledge(query) {
	return request({
		url: '/front/v2/smartPractice/getQuestionsByKnowledge',
		method: 'get',
		params: query
	})
}

// 保存练习
export function savePractice(query) {
	return request({
		url: '/front/v2/smartPractice/savePractice',
		method: 'get',
		data: query
	})
}


// 取消收藏试题
export function queCancelCollect(query) {
	let key = Object.keys(query)[0];
	let value = query[key];
	return request({
		url: '/front/v2/questions/cancelCollect?' + key + '=' + value,
		method: 'post',
	})
}

// 收藏试题
export function queCollect(query) {
	let key = Object.keys(query)[0];
	let value = query[key];
	return request({
		url: '/front/v2/questions/collect?' + key + '=' + value,
		method: 'post',
	})
}

export function questionCollect(questionId) {
	return request({
		url: '/front/questions/collect',
		method: 'post',
		params: {questionId}
	})
}

export function questionCancelCollect(questionId) {
	return request({
		url: '/front/questions/cancelCollect',
		method: 'post',
		params: {questionId}
	})
}



export function paperCollect(paperId) {
	return request({
		url: '/front/papers/collect',
		method: 'post',
		params: {paperId}
	})
}

export function paperCancelCollect(paperId) {
	return request({
		url: '/front/papers/cancelCollect',
		method: 'post',
		params: {paperId}
	})
}


// 查询组卷记录
export function paperRecords(query) {
	return request({
		url: '/front/v2/papers/paperRecords',
		method: 'get',
		params: query
	})
}

// 获取试题蓝记录
export function getQuestionCardList(query) {
	return request({
		url: '/front/v2/papers/getQuestionCardList',
		method: 'get',
		params: query
	})
}
// 保存试题栏
export function editQuestionCard(query) {
	return request({
		url: '/front/v2/papers/editQuestionCard',
		method: 'post',
		data: query,
	})
}
// 清空试题栏
export function deleteQuestionCard(query) {
	return request({
		url: '/front/v2/papers/deleteQuestionCard',
		method: 'post',
		data: query,
	})
}

// 收藏涉及的学科, type: question/paper

export function favSubjects(query) {
	return request({
		url: '/front/v2/favorites/subjects',
		method: 'get',
		params: query,
	})
}

// 收藏涉及的题型
export function favQueTypes(query) {
	return request({
		url: '/front/v2/favorites/qtypes',
		method: 'get',
		params: query,
	})
}

// 收藏的问题列表
export function favQuestions(query) {
	return request({
		url: '/front/favorites/questions',
		method: 'get',
		params: query,
	})
}

// 收藏的试卷列表
export function favPapers(query) {
	return request({
		url: '/front/favorites/papers',
		method: 'get',
		params: query,
	})
}


// 错题涉及的题型
export function wrongTypes(query) {
	return request({
		url: '/front/v2/wrongBook/qtypes',
		method: 'get',
		params: query,
	})
}

// 错题涉及的学科
export function wrongSubjects(query) {
	return request({
		url: '/front/v2/wrongBook/subjects',
		method: 'get',
		params: query,
	})
}


// 错题列表
export function wrongQuestions(query) {
	return request({
		url: '/front/v2/wrongBook/wrongQuestions',
		method: 'get',
		params: query,
	})
}

// 删除错题
export function deleteWrongQuestion(query) {
	return request({
		url: '/front/v2/wrongBook/deleteWrongQuestion',
		method: 'post',
		params: query,
	})
}

// 数据统计（总）
export function summary(query) {
	return request({
		url: '/front/v2/studyRecord/summary',
		method: 'get',
		params: query,
	})
}


// 数据统计-做题数量-按天
export function questionStatsByDay(query) {
	return request({
		url: '/front/v2/studyRecord/questionStatsByDay',
		method: 'get',
		params: query,
	})
}

//  数据统计-做题数量-按学科
export function questionStatsBySubject(query) {
	return request({
		url: '/front/v2/studyRecord/questionStatsBySubject',
		method: 'get',
		params: query,
	})
}
// 数据统计-视频观看时长 - 按天
export function videoStatsByDay(query) {
	return request({
		url: '/front/v2/studyRecord/videoStatsByDay',
		method: 'get',
		params: query,
	})
}

// 数据统计-视频观看时长 - 按学科
export function videoStatsBySubject(query) {
	return request({
		url: '/front/v2/studyRecord/videoStatsBySubject',
		method: 'get',
		params: query,
	})
}


// 视频学习记录
export function videoWatchRecords(query) {
	return request({
		url: '/front/v2/studyRecord/videoWatchRecords',
		method: 'get',
		params: query,
	})
}

// 知识点诊断记录
export function knowRecords(query) {
	return request({
		url: '/front/v2/studyRecord/knowledgeDiagnoseRecords',
		method: 'get',
		params: query,
	})
}

// 试卷是否被收藏
export function isCollected(query) {
	return request({
		url: '/front/v2/papers/isCollected',
		method: 'get',
		params: query,
	})
}

// 添加题目到试题栏
export function addToQuestionCard(query) {
	return request({
		url: '/front/v2/papers/addToQuestionCard',
		method: 'post',
		params: query,
	})
}

// 获取最底层的知识点
export function listBottoms(query) {
	return request({
		url: '/front/v2/knowledgeTree/listBottoms',
		method: 'get',
		params: query,
	})
}

// 保存试卷
export function savePaperInfo(query) {
	return request({
		url: '/front/v2/papers/savePaperInfo',
		method: 'post',
		data: query,
	})
}

// 根据题目类型和数量获取题目
export function getQuestionsByQTypeAndNum(data) {
	return request({
		url: '/front/v2/papers/getQuestionsByQTypeAndNum',
		method: 'post',
		data: data,
	})
}

// 根据章节获取知识点
export function knowByChapter(query) {
	return request({
		url: '/front/v2/knowledgeTree/listByChapter',
		method: 'get',
		params: query,
	})
}

// 举一反三
export function drawInferences(query) {
	return request({
		url: '/front/v2/smartPractice/drawInferences',
		method: 'get',
		params: query,
	})
}
export function listGrade(query) {
	return request({
		url: '/front/v2/papers/listGrade',
		method: 'get',
		params: query,
	})
}
// 试卷--  年级列表
export function paperListGrade(query) {
	return request({
		url: '/front/v2/papers/grades',
		method: 'get',
		params: query,
	})
}

//  批次线--地域
export function pckzxLocations(query) {
	return request({
		url: '/front/syzy/pckzx/locations',
		method: 'get',
		params: query,
	})
}

//  批次线--录取年份
export function pckzxYears(query) {
	return request({
		url: '/front/syzy/pckzx/years',
		method: 'get',
		params: query,
	})
}

//  批次线--批次控制线列表
export function pckzxList(query) {
	return request({
		url: '/front/syzy/pckzx/list',
		method: 'get',
		params: query,
	})
}

// 一分一段--地域
export function yfydLocations(query) {
	return request({
		url: '/front/syzy/yfyd/locations',
		method: 'get',
		params: query,
	})
}
// 一分一段--录取年份
export function yfydYears(query) {
	return request({
		url: '/front/syzy/yfyd/years',
		method: 'get',
		params: query,
	})
}
// 一分一段--科类
export function yfydModes(query) {
	return request({
		url: '/front/syzy/yfyd/modes',
		method: 'get',
		params: query,
	})
}

// 一分一段--列表
export function yfydList(query) {
	return request({
		url: '/front/syzy/yfyd/list',
		method: 'get',
		params: query,
	})
}

// 等效位次转化分
export function getEquivalentScore(query) {
	// query: { location: '湖南', year: 2024, mode: '物理', score: 580 }
	// returns: { match: match item in `yfyd/list`, scores: [{year: 2023, seat: -, score}] 近3年等效位次和等效分},
	// 注，如果当前year=2023年，应该返回 23 22 21 年的等效位次和等效分；
	// 如果当前 24年，一分一段开放前应该返回 23 22 21，一分一段开放后应该返回 24 23 22。
	return request({
		url: '/front/syzy/yfyd/getEquivalentScore',
		method: 'get',
		params: query,
	})
}


// 高考名词--详情
export function gkmcDetail(query) {
	return request({
		url: '/front/syzy/gkmc/detail',
		method: 'get',
		params: query,
	})
}

// 高考名词--详情
export function gkmc(query) {
	return request({
		url: '/front/syzy/gkmc/list',
		method: 'get',
		params: query,
	})
}

// 院校投档线--地域
export function lineLocations(query) {
	return request({
		url: '/front/syzy/tdx/university/locations',
		method: 'get',
		params: query,
	})
}

// 院校投档线--层次
export function lineLevels(query) {
	return request({
		url: '/front/syzy/tdx/university/levels',
		method: 'get',
		params: query,
	})
}
// 院校投档线--科类
export function lineTypes(query) {
	return request({
		url: '/front/syzy/tdx/university/types',
		method: 'get',
		params: query,
	})
}

// 院校投档线--录取年份
export function lineYears(query) {
	return request({
		url: '/front/syzy/tdx/university/years',
		method: 'get',
		params: query,
	})
}

export function universityList(query) {
	return request({
		url: '/front/syzy/tdx/university/list',
		method: 'get',
		params: query,
	})
}

// 专业投档线--录取年份
export function majorLineYear(query) {
	return request({
		url: '/front/syzy/tdx/marjor/years',
		method: 'get',
		params: query,
	})
}

// 专业投档线--科类
export function majorLineTypes(query) {
	return request({
		url: '/front/syzy/tdx/marjor/types',
		method: 'get',
		params: query,
	})
}

// 专业投档线--层次
export function majorLineLevels(query) {
	return request({
		url: '/front/syzy/tdx/marjor/levels',
		method: 'get',
		params: query,
	})
}

// TODO: 不明确与WEB端整个webQue.js的差异在哪儿，先哪儿缺搬哪儿
export function xkcxYears(query) {
  return request({
    url: '/front/syzy/xkcx/years',
    method: 'get',
    params: query,
  })
}

export function getAiAdStudyVideoList(params) {
  return request({
    url: '/front/videoCourse/getAiAdStudyVideoList',
    method: 'get',
    params
  })
}

export function getAiAdStudyQuestionList(params) {
  return request({
    url: '/front/v2/questions/getAiAdStudyQuestionList',
    method: 'get',
    params
  })
}

export function smartSubjectList() {
  return request({
    url: '/front/v2/subject/list',
    method: 'get',
  })
}


export function getAiSubjectVideos(params) {
  return request({
    url: '/front/ai/getAiSubjectVideos',
    method: 'get',
    params
  })
}

export function getAiSubjectPapers(params) {
  return request({
    url: '/front/ai/getAiSubjectPapers',
    method: 'get',
    params
  })
}

export function xkcxlist(query) {
	return request({
		url: '/front/syzy/xkcx/list',
		method: 'get',
		params: query
	})
}
