export interface QuizOption {
  id: string;
  label: string;
  imageUrl?: string;
}

export type QuestionType = "true-false" | "single-answer" | "multiple-answer" | "dropdown" | "multiple-dropdown" | "open-ended";

export interface SubQuestion {
  id: string;
  text: string;
  imageUrl?: string;
  options: QuizOption[];
  correctOptionId: string;
}

export interface Question {
  id: string;
  type: QuestionType;
  text: string;
  imageUrl?: string;
  options: QuizOption[];
  correctAnswers: string[];
  subQuestions?: SubQuestion[];
  hidden?: boolean;
}

export interface QuizTemplate {
  id: string;
  title: string;
  description: string;
  questions: Question[];
}

export interface User {
  id: string;
  username: string;
  password: string;
  role: "admin" | "user";
}

export type TimerMode = "per-question" | "total" | "none";

export type QuizMode = "testing" | "learning";

export interface QuizConfig {
  templateIds: string[];
  timerMode: TimerMode;
  perQuestionSeconds: number;
  totalSeconds: number;
  questionCount: number;
  quizTheme: QuizTheme;
  quizMode: QuizMode;
}

export interface QuizAnswer {
  questionId: string;
  selectedAnswers: string[];
}

export interface QuizResult {
  totalQuestions: number;
  correctCount: number;
  answers: (QuizAnswer & { correct: boolean })[];
}

export type QuizTheme = "classmaker" | "modern";

export interface AppSettings {
  quizTheme: QuizTheme;
  userPathTemplateIds?: string[];
}

export interface QuizUser {
  id: string;
  name: string;
  email: string;
  createdAt: string;
  lastSeenAt: string;
}

export interface QuizAttempt {
  id: string;
  userId: string;
  userName?: string;
  source?: "user" | "advanced";
  quizMode: QuizMode;
  questions: Question[];
  answers: QuizAnswer[];
  status: "in-progress" | "completed";
  answeredCount: number;
  totalQuestions: number;
  correctCount: number | null;
  score: number | null;
  startedAt: string;
  completedAt: string | null;
  lastUpdatedAt: string;
}
