import type { ProposalContent } from "@/lib/proposal/schema";

type Props = {
  synthesis: ProposalContent["problemSynthesis"];
  type: "problem";
};

export function SynthesisDiagramSection({ synthesis }: Props) {
  return (
    <div className="h-full flex flex-col justify-center px-16 py-24 space-y-10">
      <div>
        <p className="text-xs font-mono tracking-widest text-muted-foreground uppercase">Sintesi del problema</p>
        <h2 className="text-5xl font-light text-foreground mt-4">
          Cinque nodi, <span className="text-destructive">una sola radice.</span>
        </h2>
        <p className="text-base text-muted-foreground mt-4 max-w-2xl">
          I cinque nodi convergono su un&apos;unica domanda strategica non ancora risolta. Sciolto quel nodo, gli altri trovano il proprio posto.
        </p>
      </div>

      {/* Diagramma semplice: nodi → radice comune */}
      <div className="space-y-8">
        {/* Nodi */}
        <div className="flex items-center justify-between gap-4">
          {synthesis.nodeLabels.map((label, i) => (
            <div
              key={i}
              className="flex-1 border border-border rounded-lg px-4 py-3 text-center"
            >
              <p className="text-xs font-mono text-muted-foreground mb-1">0{i + 1} →</p>
              <p className="text-sm font-medium text-foreground">{label}</p>
            </div>
          ))}
        </div>

        {/* Connettori */}
        <div className="flex justify-center">
          <div className="w-px h-8 bg-destructive/30" />
        </div>

        {/* Radice */}
        <div className="mx-auto max-w-lg border border-destructive/30 bg-destructive/5 rounded-xl p-6 text-center">
          <p className="text-xs font-mono tracking-widest text-destructive uppercase mb-2">
            La radice comune
          </p>
          <p className="text-sm font-medium text-foreground">{synthesis.rootCause}</p>
        </div>
      </div>
    </div>
  );
}
