'use client'

import { lazy, Suspense } from 'react'

import { AuthGuard } from '@/components/auth-guard'

// Ленивая загрузка дашборда сотрудников
const EmployeesDashboard = lazy(() =>
  import('@/components/employees/employees-dashboard').then((mod) => ({
    default: mod.EmployeesDashboard,
  })),
)

// Компонент загрузки для сотрудников
function LoadingFallback() {
  return (
    <div className="flex items-center justify-center min-h-screen">
      <div className="text-center space-y-4">
        <div className="w-8 h-8 border-4 border-orange-600 border-t-transparent rounded-full animate-spin mx-auto"></div>
        <p className="text-white/60">Загрузка управления сотрудниками...</p>
      </div>
    </div>
  )
}

export default function EmployeesPage() {
  return (
    <AuthGuard>
      <Suspense fallback={<LoadingFallback />}>
        <EmployeesDashboard />
      </Suspense>
    </AuthGuard>
  )
}
