"use client";

import { Card, CardContent } from "@/components/ui/card";

interface TreeViewContainerProps {
  children: React.ReactNode;
  isLoading?: boolean;
  loadingMessage?: string;
  emptyState?: React.ReactNode;
  hasContent?: boolean;
}

export function TreeViewContainer({
  children,
  isLoading = false,
  loadingMessage = "Chargement...",
  emptyState,
  hasContent = true,
}: TreeViewContainerProps) {
  if (isLoading) {
    return (
      <div className="text-center py-8">
        <div className="animate-spin rounded-full h-6 w-6 border-b-2 border-blue-400 mx-auto mb-3"></div>
        <p className="text-slate-400 text-sm">{loadingMessage}</p>
      </div>
    );
  }

  if (!hasContent && emptyState) {
    return emptyState;
  }

  return (
    <Card className="bg-white/5 border-white/10">
      <CardContent className="p-0">{children}</CardContent>
    </Card>
  );
}
