import { tasksService } from '@/services/tasks';
import { tagsService } from '@/services/tags';
import { userPreferencesService } from '@/services/user-preferences';
import { HomePageClient } from '@/components/HomePageClient';

// Force dynamic rendering (no static generation)
export const dynamic = 'force-dynamic';

export default async function HomePage() {
  // SSR - Récupération des données côté serveur
  const [initialTasks, initialStats, initialTags, initialPreferences] = await Promise.all([
    tasksService.getTasks(),
    tasksService.getTaskStats(),
    tagsService.getTags(),
    userPreferencesService.getAllPreferences()
  ]);

  return (
    <HomePageClient 
      initialTasks={initialTasks}
      initialStats={initialStats}
      initialTags={initialTags}
      initialPreferences={initialPreferences}
    />
  );
}
