import { tasksService } from '@/services/task-management/tasks';
import { tagsService } from '@/services/task-management/tags';
import { AnalyticsService } from '@/services/analytics/analytics';
import { DeadlineAnalyticsService } from '@/services/analytics/deadline-analytics';
import { TagAnalyticsService } from '@/services/analytics/tag-analytics';
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, initialTags, initialStats, productivityMetrics, deadlineMetrics, tagMetrics] = await Promise.all([
    tasksService.getTasks(),
    tagsService.getTags(),
    tasksService.getTaskStats(),
    AnalyticsService.getProductivityMetrics(),
    DeadlineAnalyticsService.getDeadlineMetrics(),
    TagAnalyticsService.getTagDistributionMetrics()
  ]);

  return (
    <HomePageClient 
      initialTasks={initialTasks}
      initialTags={initialTags}
      initialStats={initialStats}
      productivityMetrics={productivityMetrics}
      deadlineMetrics={deadlineMetrics}
      tagMetrics={tagMetrics}
    />
  );
}
