'use client';

import { KanbanBoardContainer } from '@/components/kanban/BoardContainer';
import { Header } from '@/components/ui/Header';
import { TasksProvider, useTasksContext } from '@/contexts/TasksContext';
import { Task, Tag } from '@/lib/types';

interface HomePageClientProps {
  initialTasks: Task[];
  initialStats: {
    total: number;
    completed: number;
    inProgress: number;
    todo: number;
    cancelled: number;
    freeze: number;
    completionRate: number;
  };
  initialTags: (Tag & { usage: number })[];
}

function HomePageContent() {
  const { stats, syncing } = useTasksContext();

  return (
    <div className="min-h-screen bg-slate-950">
      <Header 
        title="TowerControl" 
        subtitle="Gestionnaire de tâches moderne"
        stats={stats}
        syncing={syncing}
      />
      
      <main className="h-[calc(100vh-120px)]">
        <KanbanBoardContainer />
      </main>
    </div>
  );
}

export function HomePageClient({ initialTasks, initialStats, initialTags }: HomePageClientProps) {
  return (
    <TasksProvider 
      initialTasks={initialTasks} 
      initialStats={initialStats}
      initialTags={initialTags}
    >
      <HomePageContent />
    </TasksProvider>
  );
}
