import {CameraTool} from './tool/camera.js';
import {ModeSwitch} from './tool/modes.js';
import {ObjectTool} from './tool/object.js';
import {ObjectsTool} from './tool/objects.js';
import {OptionsTool} from './tool/options.js';
import {PlayPause} from './tool/play-pause.js';
import {StateTool} from './tool/state.js';
import {UtilityTool} from './tool/utility.js';
import {Zoom} from './tool/zoom.js';
import {ToolbarGroup} from './toolbar-group.js';
import {Toolbar} from './toolbar.js';

export function initializeTools(sim) {
  sim.toolbarGroups = {
    left: new ToolbarGroup(sim)
      .addToolbar(new Toolbar(sim, 'Camera')
        .addTool(new CameraTool())
      )
      .addToolbar(new Toolbar(sim, 'Tools')
        .addTool(new Zoom())
        .addTool(new PlayPause())
      )
      .addToolbar(new Toolbar(sim, 'Modes')
        .addTool(new ModeSwitch())
      )
      .addToolbar(new Toolbar(sim, 'Utils', {expanded: false})
        .addTool(new UtilityTool())
      )
      .addToolbar(new Toolbar(sim, 'Objects')
        .addTool(new ObjectsTool()),
      ),
    right: new ToolbarGroup(sim).topRight()
      .addToolbar(new Toolbar(sim, 'State')
        .addTool(new StateTool())
      )
      .addToolbar(new Toolbar(sim, 'Options')
        .addTool(new OptionsTool(['pauseDuring', 'display', 'compensate']))
      )
      .addToolbar(new Toolbar(sim, 'Params')
        .addTool(new OptionsTool([
          'param'
        ])),
      )
      .addToolbar(new Toolbar(sim, 'Debug', {expanded: false})
        .addTool(new OptionsTool(['debug'])),
      )
      .addToolbar(new Toolbar(sim, 'Object')
        .addTool(new ObjectTool()),
      ),
  };

  for (const groupName in sim.toolbarGroups) {
    const group = sim.toolbarGroups[groupName];
    group.applyExpanded();
  }
}
