import type { QuizQuestionAnswer, QuizQuestionProps } from "../quiz-question"; export interface QuizProps { questions: Question[]; disabled?: boolean; required?: boolean; } interface QuestionBase { /** * Question text, can be plain text or contain code. * If the question text contains code, use the PrismFormatted component to ensure the code is rendered correctly. */ question: QuizQuestionProps["question"]; /** * Answer options */ answers: QuizQuestionAnswer[]; /** * Value of the correct answer */ correctAnswer: AnswerT; /** * Change event handler, called when an answer is selected */ onChange?: (selectedAnswer: AnswerT) => void; /** * Value of the selected answer */ selectedAnswer?: AnswerT; } type QuestionWithoutAudio = QuestionBase & { audioUrl?: never; audioAriaLabel?: never; transcript?: never; audioStartTime?: never; audioFinishTime?: never; }; type QuestionWithAudio = QuestionBase & { /** * URL to an audio file for the question */ audioUrl: string; /** * Accessible label for the audio element */ audioAriaLabel: string; /** * Transcript text for the audio */ transcript: string; /** * Start time in seconds for the audio segment */ audioStartTime?: number; /** * Finish time in seconds for the audio segment */ audioFinishTime?: number; }; export type Question = QuestionWithoutAudio | QuestionWithAudio; export {};