import { Exam, ExamSubmission } from "../modules/exams/types"

export let MOCK_EXAMS: Exam[] = [
  {
    id: "exam_001",
    title: "Algebra Midterm",
    subject: "Mathematics",
    subjectId: "subj_math",
    grade: "Grade 10",
    status: "draft",
    difficulty: 3,
    totalScore: 100,
    durationMin: 90,
    questionCount: 25,
    scheduledAt: undefined,
    createdAt: new Date().toISOString(),
    tags: ["Algebra", "Functions"],
  },
  {
    id: "exam_002",
    title: "Physics Mechanics Quiz",
    subject: "Physics",
    subjectId: "subj_physics",
    grade: "Grade 11",
    status: "published",
    difficulty: 4,
    totalScore: 50,
    durationMin: 45,
    questionCount: 15,
    scheduledAt: new Date(Date.now() + 86400000).toISOString(),
    createdAt: new Date().toISOString(),
    tags: ["Mechanics", "Kinematics"],
  },
  {
    id: "exam_003",
    title: "English Reading Comprehension",
    subject: "English",
    subjectId: "subj_english",
    grade: "Grade 12",
    status: "published",
    difficulty: 2,
    totalScore: 80,
    durationMin: 60,
    questionCount: 20,
    scheduledAt: new Date(Date.now() + 2 * 86400000).toISOString(),
    createdAt: new Date().toISOString(),
    tags: ["Reading", "Vocabulary"],
  },
  {
    id: "exam_004",
    title: "Chemistry Final",
    subject: "Chemistry",
    subjectId: "subj_chemistry",
    grade: "Grade 12",
    status: "archived",
    difficulty: 5,
    totalScore: 120,
    durationMin: 120,
    questionCount: 40,
    scheduledAt: new Date(Date.now() - 30 * 86400000).toISOString(),
    createdAt: new Date().toISOString(),
    tags: ["Organic", "Inorganic"],
  },
  {
    id: "exam_005",
    title: "Geometry Chapter Test",
    subject: "Mathematics",
    subjectId: "subj_math",
    grade: "Grade 9",
    status: "published",
    difficulty: 3,
    totalScore: 60,
    durationMin: 50,
    questionCount: 18,
    scheduledAt: new Date(Date.now() + 3 * 86400000).toISOString(),
    createdAt: new Date().toISOString(),
    tags: ["Geometry", "Triangles"],
  },
]

export const MOCK_SUBMISSIONS: ExamSubmission[] = [
  {
    id: "sub_001",
    examId: "exam_002",
    examTitle: "Physics Mechanics Quiz",
    studentName: "Alice Zhang",
    submittedAt: new Date().toISOString(),
    status: "pending",
  },
  {
    id: "sub_002",
    examId: "exam_003",
    examTitle: "English Reading Comprehension",
    studentName: "Bob Li",
    submittedAt: new Date().toISOString(),
    score: 72,
    status: "graded",
  },
]

export function addMockExam(exam: Exam) {
  MOCK_EXAMS = [exam, ...MOCK_EXAMS]
}

export function updateMockExam(id: string, updates: Partial<Exam>) {
  MOCK_EXAMS = MOCK_EXAMS.map((e) => (e.id === id ? { ...e, ...updates } : e))
}
