import { AdminService } from "@/services/admin-service";
import { AdminClientWrapper } from "@/components/admin";

export default async function AdminPage() {
  // Charger les données côté serveur
  try {
    const adminData = await AdminService.getAdminData();

    return (
      <AdminClientWrapper
        teams={adminData.teams}
        skillCategories={adminData.skillCategories}
        teamStats={adminData.teamStats}
        directionStats={adminData.directionStats}
      />
    );
  } catch (error) {
    console.error("Failed to load admin data:", error);
    return (
      <div className="container mx-auto p-6">
        <div className="flex items-center justify-center h-64">
          <div className="text-lg text-red-500">
            Erreur lors du chargement des données d'administration
          </div>
        </div>
      </div>
    );
  }
}
