export interface SafetyQuizComplianceRow {
  readonly name: string;
  readonly role: string;
  readonly status: 'complete';
  readonly score: string;
  readonly date: string;
}

export interface SafetyQuizSubmission {
  readonly quizId: string;
  readonly quizTitle: string;
  readonly weekOf: string;
  readonly score: number;
  readonly totalQuestions: number;
  readonly answers: readonly number[];
}

export interface SafetyQuizCompletionSummary {
  readonly completedCount: number;
  readonly totalStaff: number;
  readonly completionRate: number;
}

export type SafetyQuizStage = 'intro' | 'question' | 'complete';

export interface SafetyQuizPage {
  readonly quiz: import('@/shared/types/app').SafetyQuiz | null;
  readonly weekOf: string;
  readonly stage: SafetyQuizStage;
  readonly currentQuestionIndex: number;
  readonly selectedAnswer: number | null;
  readonly showExplanation: boolean;
  readonly score: number;
  readonly answers: readonly number[];
  readonly complianceRows: readonly SafetyQuizComplianceRow[];
  readonly completionSummary: SafetyQuizCompletionSummary;
  readonly canViewCompliance: boolean;
  readonly canManageQuizContent: boolean;
  readonly isQuizLoading: boolean;
  readonly isComplianceLoading: boolean;
  readonly isSavingResult: boolean;
  readonly quizError: unknown;
  readonly complianceError: unknown;
  readonly saveResultError: unknown;
  readonly startQuiz: () => void;
  readonly selectAnswer: (answerIndex: number) => void;
  readonly goToNextQuestion: () => Promise<void>;
  readonly resetQuiz: () => void;
}

export interface SafetyQuizContentEditor {
  readonly draft: string;
  readonly isLoading: boolean;
  readonly isSaving: boolean;
  readonly errorMessage: string | null;
  readonly validationError: string | null;
  readonly savedMessage: string | null;
  readonly canSave: boolean;
  readonly setDraft: (draft: string) => void;
  readonly reset: () => void;
  readonly save: () => Promise<void>;
}
