66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
|
|
export type PracticeQuestionEditorType = "MCQ" | "TRUE_FALSE" | "SHORT" | "AUDIO" | "DYNAMIC"
|
|
|
|
export type PracticeQuestionEditorDifficulty = "EASY" | "MEDIUM" | "HARD"
|
|
|
|
export interface PracticeQuestionOptionDraft {
|
|
text: string
|
|
isCorrect: boolean
|
|
}
|
|
|
|
export interface PracticeQuestionDynamicRow {
|
|
id: string
|
|
kind: string
|
|
label?: string
|
|
required?: boolean
|
|
}
|
|
|
|
export interface PracticeQuestionEditorValue {
|
|
questionText: string
|
|
questionType: PracticeQuestionEditorType
|
|
difficultyLevel: PracticeQuestionEditorDifficulty
|
|
points: number
|
|
tips: string
|
|
explanation: string
|
|
options: PracticeQuestionOptionDraft[]
|
|
voicePrompt: string
|
|
sampleAnswerVoicePrompt: string
|
|
audioCorrectAnswerText: string
|
|
shortAnswer: string
|
|
/** Stored URL or object key; same semantics as Speaking practice editor */
|
|
imageUrl: string
|
|
/** When `questionType` is DYNAMIC — definition used to shape `dynamic_payload` */
|
|
questionTypeDefinitionId: number | null
|
|
dynamicStimulusRows: PracticeQuestionDynamicRow[]
|
|
dynamicResponseRows: PracticeQuestionDynamicRow[]
|
|
/** Keys `stimulus:${elementId}` and `response:${elementId}` (ids from the type definition schema) */
|
|
dynamicFieldValues: Record<string, string>
|
|
}
|
|
|
|
export function createEmptyPracticeQuestionDraft(): PracticeQuestionEditorValue {
|
|
return {
|
|
questionText: "",
|
|
questionType: "MCQ",
|
|
difficultyLevel: "EASY",
|
|
points: 1,
|
|
tips: "",
|
|
explanation: "",
|
|
options: [
|
|
{ text: "", isCorrect: true },
|
|
{ text: "", isCorrect: false },
|
|
{ text: "", isCorrect: false },
|
|
{ text: "", isCorrect: false },
|
|
],
|
|
voicePrompt: "",
|
|
sampleAnswerVoicePrompt: "",
|
|
audioCorrectAnswerText: "",
|
|
shortAnswer: "",
|
|
imageUrl: "",
|
|
questionTypeDefinitionId: null,
|
|
dynamicStimulusRows: [],
|
|
dynamicResponseRows: [],
|
|
dynamicFieldValues: {},
|
|
}
|
|
}
|
|
|