47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
export enum QuestionTypes {
|
|
SelectOne,
|
|
SelectMultiple,
|
|
AssignValues,
|
|
TextInput
|
|
}
|
|
|
|
export interface BaseQuestion {
|
|
/**
|
|
* Unique ID
|
|
*/
|
|
id: string;
|
|
title: string;
|
|
images: string[];
|
|
type: QuestionTypes;
|
|
}
|
|
|
|
export interface SelectOneQuestion extends BaseQuestion {
|
|
type: QuestionTypes.SelectOne;
|
|
options: { [key: string]: string };
|
|
correct: string;
|
|
}
|
|
|
|
export interface SelectMultipleQuestion extends BaseQuestion {
|
|
type: QuestionTypes.SelectMultiple;
|
|
options: { [key: string]: string };
|
|
correct: string[];
|
|
}
|
|
|
|
export interface AssignValuesQuestion extends BaseQuestion {
|
|
type: QuestionTypes.AssignValues;
|
|
fields: { [key: string]: string };
|
|
values: { [key: string]: string };
|
|
correct: { [key: string]: string };
|
|
}
|
|
|
|
export interface TextInputQuestion extends BaseQuestion {
|
|
type: QuestionTypes.TextInput;
|
|
correct: string;
|
|
}
|
|
|
|
export type Question = SelectOneQuestion | SelectMultipleQuestion | AssignValuesQuestion | TextInputQuestion;
|
|
|
|
export interface Exam {
|
|
title: string;
|
|
questions: Question[];
|
|
} |