import { ref, computed } from "vue";

/**答题模式切换 */
export const useTopicMode = () => {
  const answerTypeList = ref([
    { name: "顺序练习" },
    { name: "随机练习" },
    { name: "背题模式" },
  ]);
  const currentType = ref(0);
  const typeParams = computed(() => {
    switch (currentType.value) {
      case 0:
        return {
          order: true, //顺序练习
          answerShow: false, //背题模式
        };
      case 1:
        return {
          order: false, //顺序练习
          answerShow: false, //背题模式
        };
      case 2:
        return {
          order: true, //顺序练习
          answerShow: true, //背题模式
        };
      default:
        return {
          order: true, //顺序练习
          answerShow: false, //背题模式
        };
    }
  });

  return {
    answerTypeList,
    currentType,
    typeParams,
  };
};
