generated from muhtadeetaron/nextjs-template
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
export interface Question {
|
|
id: string;
|
|
text: string;
|
|
options?: string[];
|
|
type: "multiple-choice" | "text" | "boolean";
|
|
}
|
|
|
|
export interface Exam {
|
|
id: string;
|
|
title: string;
|
|
description: string;
|
|
questions: Question[];
|
|
timeLimit?: number;
|
|
passingScore?: number;
|
|
}
|
|
|
|
export interface ExamAnswer {
|
|
questionId: string;
|
|
answer: any;
|
|
timestamp: Date;
|
|
}
|
|
|
|
export interface ExamAttempt {
|
|
examId: string;
|
|
exam: Exam;
|
|
answers: ExamAnswer[];
|
|
startTime: Date;
|
|
endTime?: Date;
|
|
score?: number;
|
|
passed?: boolean;
|
|
apiResponse?: any;
|
|
}
|
|
|
|
export interface ExamContextType {
|
|
currentExam: Exam | null;
|
|
currentAttempt: ExamAttempt | null;
|
|
isHydrated: boolean;
|
|
isInitialized: boolean;
|
|
|
|
// Actions
|
|
setCurrentExam: (exam: Exam) => void;
|
|
startExam: () => void;
|
|
setAnswer: (questionId: string, answer: any) => void;
|
|
submitExam: () => ExamAttempt;
|
|
clearExam: () => void;
|
|
setApiResponse: (response: any) => void;
|
|
|
|
// Getters
|
|
getAnswer: (questionId: string) => any;
|
|
getProgress: () => number;
|
|
isExamStarted: () => boolean;
|
|
isExamCompleted: () => boolean;
|
|
getApiResponse: () => any;
|
|
}
|