<template>
  <component
    :is="currentComponent"
    @next="next"
    v-model:userTestData="userTestData"
  ></component>
</template>

<script lang="ts" setup>
import initMockTest from "./components/initMockTest.vue";
import mockTestEnd from "./components/mockTestEnd.vue";
import startTest from "./components/startTest.vue";

import { ref, reactive } from "vue";

const userTestData = ref({
  testScores: 0,
  useTime: 0,
});

const currentComponent = ref<any>(initMockTest);
const comIndex = ref(0);
const next = () => {
  comIndex.value = (comIndex.value + 1) % 3;
  switch (comIndex.value) {
    case 0:
      currentComponent.value = initMockTest;
      break;
    case 1:
      currentComponent.value = startTest;
      break;
    case 2:
      currentComponent.value = mockTestEnd;
      break;
  }
};
</script>

<style scoped lang="scss"></style>
