import docNode from './documentNode';
import downloadNode from './downloadNode';
import makeFileNode from './makeFileNode';
import nodeNames from './nodeNames';
import { PluginNode } from './pluginNode';
import { SaveDatasetNode } from './saveDataset';
import { SearchDatasetNode } from './searchDataset';
import { WorkflowNode } from './workflowNode';

export interface CustomNodeOptions {
  handleChosen?: (nodeType: string, updateNodeData: any, value: string) => void;
}
export const getCustomNode = async (options: CustomNodeOptions) => {
  const pluginNode = PluginNode({ onChosen: options.handleChosen });
  const workflowNode = WorkflowNode({ onChosen: options.handleChosen });
  const searchDatasetNode = await SearchDatasetNode();
  const saveDatasetNode = await SaveDatasetNode();
  return {
    ...docNode,
    ...makeFileNode,
    ...downloadNode,
    [nodeNames.pluginNode]: pluginNode,
    [nodeNames.workflowNode]: workflowNode,
    [nodeNames.searchDatasetNode]: searchDatasetNode,
    [nodeNames.saveDatasetNode]: saveDatasetNode,
  };
};
