"use client"

import { AuthProvider, useAuth } from "@/lib/auth-context"
import { AuthScreen } from "@/components/auth/auth-screen"
import { AppShell } from "@/components/layout/app-shell"
import { TeacherDashboard } from "@/components/dashboard/teacher-dashboard"
import { SupervisorDashboard } from "@/components/dashboard/supervisor-dashboard"

function AppContent() {
  const { user } = useAuth()

  if (!user) {
    return <AuthScreen />
  }

  return (
    <AppShell>
      {user.role === "LEHRKRAFT" ? <TeacherDashboard /> : <SupervisorDashboard />}
    </AppShell>
  )
}

export default function Home() {
  return (
    <AuthProvider>
      <AppContent />
    </AuthProvider>
  )
}
