import { plugins, material } from "@alilc/lowcode-engine";
import alilcLocalePlugin from '@alilc/lowcode-plugin-zh-en';
import alilcSchemaPlugin from '@alilc/lowcode-plugin-schema';
import alilcCodePlugin from "@alilc/lowcode-plugin-code-editor";
import alilcUndoRedoPlugin from '@alilc/lowcode-plugin-undo-redo';
import alilcCodeGenPlugin from '@alilc/lowcode-plugin-code-generator';
import alilcDataSourcePlugin from '@alilc/lowcode-plugin-datasource-pane';
import commonSavePlugin from './save';
import commonSimulatorPlugin from './simulator-resize';
import commonComponentsPlugin from './components-pane';
import aliLocalePlugin from './locale';
import aliCodePlugin from './code-pane';
import aliSchemaPlugin from './schema-pane';
import aliUndoRedoPlugin from './undo-redo';
import aliDataSourcePlugin from './datasource-pane';
var isNewEngineVersion = !!material;
plugins.register(commonSimulatorPlugin);
plugins.register(commonComponentsPlugin);

if (isNewEngineVersion) {
  // 注册回退/前进
  plugins.register(alilcUndoRedoPlugin); // 注册出码插件

  alilcCodeGenPlugin.pluginName = 'alilcCodeGenPlugin';
  plugins.register(alilcCodeGenPlugin);
  plugins.register(alilcLocalePlugin);
  alilcSchemaPlugin.pluginName = 'alilcSchemaPlugin';
  plugins.register(alilcSchemaPlugin);
  alilcDataSourcePlugin.pluginName = 'alilcDataSourcePlugin';
  plugins.register(alilcDataSourcePlugin);
  alilcCodePlugin.pluginName = 'alilcCodePlugin';
  plugins.register(alilcCodePlugin);
} else {
  plugins.register(aliLocalePlugin);
  plugins.register(aliCodePlugin);
  plugins.register(aliSchemaPlugin);
  plugins.register(aliUndoRedoPlugin);
  plugins.register(aliDataSourcePlugin);
}

plugins.register(commonSavePlugin);