import { Stethoscope } from "lucide-react"
import { getAuthContext } from "@/shared/lib/auth-guard"
import { getStudentMasterySummary } from "@/modules/diagnostic/data-access"
import { getDiagnosticReports } from "@/modules/diagnostic/data-access-reports"
import { StudentDiagnosticView } from "@/modules/diagnostic/components/student-diagnostic-view"

export const dynamic = "force-dynamic"

export default async function StudentDiagnosticPage() {
  const ctx = await getAuthContext()

  const [summary, reports] = await Promise.all([
    getStudentMasterySummary(ctx.userId),
    getDiagnosticReports({ studentId: ctx.userId }),
  ])

  return (
    <div className="h-full flex-1 flex-col space-y-8 p-8 md:flex">
      <div>
        <h2 className="flex items-center gap-2 text-2xl font-bold tracking-tight">
          <Stethoscope className="h-6 w-6" />
          My Diagnostic
        </h2>
        <p className="text-muted-foreground">
          Your knowledge point mastery analysis and diagnostic reports.
        </p>
      </div>
      <StudentDiagnosticView summary={summary} reports={reports} />
    </div>
  )
}
