import { request } from 'umi';
import type { CardListItemDataType } from './data.d';

/**
 * 获取服务器时间
 *  /dsideal_yy/zygh/training/examination/getCurrentDate
 * @param params
 * @returns
 */
export async function getCurrentDate(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/examination/getCurrentDate', {
    params,
  });
}
/**
 * 【6.5】（教师首页）当前学习主题课程信息
 *  /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject
 * @param params
 * @returns
 */
export async function listMyLearningSubject(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject', {
    params,
  });
}



/**
 * 【3.2.1】查看主题基本信息
 *  /dsideal_yy/ypt/careerTraining/subject/getSubjectInfo
 * @param params
 * @returns
 */
export async function getSubjectInfo(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/ypt/careerTraining/subject/getSubjectInfo', {
    params,
  });
}
/**
 * 【6.5】（教师首页）当前学习主题课程信息
 *  /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject
 * @param params
 * @returns
 */
export async function getRulesList(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/rules/getRulesList', {
    params,
  });
}
/**
 * 05 组卷详情查询
 * /dsideal_yy/zygh/training/rules/getRulesPaper
 * @param params
 * @returns
 */
export async function getRulesPaper(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/rules/getRulesPaper', {
    params,
  });
}
/**
 * 14 保存考试结果，返回当前得分
 * /dsideal_yy/zygh/training/person/finishExamination
 * @param params
 * @returns
 */

export async function finishExamination(
  params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/person/finishExamination', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params,
    },
  });
}
/**
 * 章节测验 03 保存试题答案
 * /dsideal_yy/zygh/training/person/finishExamination
 * @param params
 * @returns
 */

export async function savePersonAnswer(
  params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/mock/savePersonAnswer', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params,
    },
  });
}






/**
 * 06 获取试卷内容
 * /dsideal_yy/zygh/training/rules/getPaperQuestionList
 * @param params
 * @returns
 */
export async function getPaperQuestionList(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/rules/getPaperQuestionList', {
    params,
  });
}

/**
 * 章节 02 开始考试->试题列表
 * /dsideal_yy/zygh/training/mock/getCourseQuestionList
 * @param params
 * @returns
 */
export async function getCourseQuestionList(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/mock/getCourseQuestionList', {
    params,
  });
}

/**
 * 章节 02 开始考试->试题列表
 * /dsideal_yy/zygh/training/mock/getErrorQuestionList
 * @param params
 * @returns
 */
export async function getErrorQuestionList(params: {
  page_size: number;
  //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
  return request('/dsideal_yy/zygh/training/mock/getErrorQuestionList', {
    params,
  });
}

export async function viewMyLearningSubject(params: {
  identity_id: number;
  person_id: number;
  data_id: number;
  data_type: number;
  subject_id: number
}) {
  return request(' /dsideal_yy/ypt/careerTraining/learning/viewMyLearningSubject', {
    params,
  });
}

export async function listMyLearningChapterCourse(params: {
  chapter_id: number;
  identity_id: number;
  person_id: number;
  subject_id: number
}) {
  return request(' /dsideal_yy/ypt/careerTraining/learning/listMyLearningChapterCourse', {
    params,
  });
}

export async function getCourseExaminationProgressList(params: {
  chapter_id: number;
  identity_id: number;
  person_id: number;
  subject_id: number
}) {
  return request('/dsideal_yy/zygh/training/mock/getCourseExaminationProgressList', {
    params,
  });
}
