"use client";

import React from "react";
import { Toaster } from "react-hot-toast";
import { DataFlowDesigner } from "@/components/dataflow/DataFlowDesigner";
import { useAuth } from "@/hooks/useAuth";
import { TableRelationship } from "@/lib/api/dataflow";

export default function DataFlowPage() {
  const { user } = useAuth();

  const handleSave = (relationships: TableRelationship[]) => {
    console.log("저장된 관계:", relationships);
    // TODO: API 호출로 관계 저장
  };

  return (
    <div className="h-screen bg-gray-50">
      <DataFlowDesigner companyCode={user?.company_code || "COMP001"} onSave={handleSave} />
      <Toaster />
    </div>
  );
}
