import React from "react";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { useDashboardVisualizationData } from "@/hooks/useDashboardVisualizationData";
import { NetworkCentralityAnalysis } from "./visualizations/NetworkCentralityAnalysis";
import { FailureImpactNetworkAnalysis } from "./visualizations/FailureImpactNetworkAnalysis";

interface DashboardVisualizationProps {
  className?: string;
}

export function DashboardVisualization({
  className,
}: DashboardVisualizationProps) {
  const { error } = useDashboardVisualizationData();

  if (error) {
    return (
      <div className={className}>
        <Alert variant="destructive">
          <AlertDescription>
            Failed to load visualization data: {error}
          </AlertDescription>
        </Alert>
      </div>
    );
  }

  return (
    <div className={className}>
      <div className="grid grid-cols-1 xl:grid-cols-2 gap-6 items-stretch">
        {/* Left Side - Network Centrality (Critical System Components) */}
        <NetworkCentralityAnalysis />

        {/* Right Side - Failure Impact (Risk Distribution) */}
        <FailureImpactNetworkAnalysis />
      </div>
    </div>
  );
}
