import TreeviewButton from "./tree-view-button";
import bundle from "./bundle";
import downloadBundle from "./download-bundle";

export const plugin = (controls) => {
  return {
    pluginName: "LayerTree",
    enabled: true,
    bundle: controls
      ? [bundle(controls), downloadBundle]
      : [
          bundle(["toggleExpand", "addAll", "removeAll", "toggleFilter"]),
          downloadBundle,
        ],
    components: [
      {
        component: TreeviewButton,
        region: "left-sidebar-top",
        sortOrder: 20,
      },
    ],
  };
};

export default plugin;
