import { Exam, ExerciseOnlyExam, PartExam } from "@/interfaces/exam";

const hasDivider = (exam: Exam, index: number) => {
    const isPartExam = ["reading", "listening", "level"].includes(exam.module);
    if (isPartExam) {
        return typeof (exam as PartExam).parts[index].intro === "string" && (exam as PartExam).parts[index].intro !== "";
    }
    return typeof (exam as ExerciseOnlyExam).exercises[index].intro === "string" && (exam as ExerciseOnlyExam).exercises[index].intro !== ""
}

export default hasDivider;
