import { CopyButton } from "./CopyButton";
import type { ToolId } from "@/lib/tools/_shared/types";

export function CodeOutput({ code, tool, label }: { code: string; tool: ToolId; label?: string }) {
  return (
    <div className="flex flex-col gap-2">
      {label && <div className="text-xs font-bold tracking-wide" style={{ color: "var(--muted-foreground)" }}>{label}</div>}
      <pre
        className="overflow-auto p-3 text-sm"
        style={{
          fontFamily: "var(--font-mono, 'Fira Mono', monospace)",
          border: "1px solid var(--border)",
          borderRadius: "2px",
          backgroundColor: "var(--background)",
          color: "var(--foreground)",
        }}
      >{code}</pre>
      <div><CopyButton text={code} tool={tool} /></div>
    </div>
  );
}
