import BaseStore from '@src/stores/base';

export default class SentenceStore extends BaseStore {
  /**
   * 所有长难句信息
   */
  getInfo() {
    return this.apiGet('/sentence/info');
  }

  /**
   * 激活长难句
   * @param {*} code
   */
  active(code) {
    return this.apiPut('/sentence/active', { code });
  }

  /**
   * 文章列表
   * @param {*} chapter
   */
  listArticle(chapter) {
    return this.apiGet('/sentence/article/list', { chapter });
  }

  /**
   * 更新长难句文章进度
   * @param {*} chapter
   * @param {*} part
   * @param {*} process
   */
  updateProcess(chapter, part, process) {
    return this.apiPut('/sentence/article/process', { chapter, part, process });
  }

  /**
   * 长难句组卷列表
   */
  listPaper() {
    return this.apiGet('/sentence/paper/list');
  }

  /**
   * 获取题目详情
   * @param {*} questionNoId
   */
  detail(questionNoId) {
    return this.apiGet('/sentence/question/detail', { questionNoId });
  }

  /**
   * 开始做题
   * @param {*} paperId
   */
  start(paperId) {
    return this.apiPost('/sentence/paper/start', { paperId });
  }

  /**
   * 获取下一题
   * @param {*} reportId
   */
  next(reportId) {
    return this.apiPost('/sentence/paper/next', { reportId });
  }

  /**
   * 提交题目答案
   * @param {*} questionNoId
   */
  submit(questionNoId) {
    return this.apiPost('//sentence/paper/submit', { questionNoId });
  }

  /**
   * 完成考试
   * @param {*} paperId
   */
  finish(paperId) {
    return this.apiPost('/qu/sentence/paperstion/finish', { paperId });
  }
}

export const Sentence = new SentenceStore({ key: 'sentence' });