import { ALL_TOOLBARS } from '../../AdaptableState/Common/Types';
import { ApiBase } from '../Implementation/ApiBase';
export class DashboardInternalApi extends ApiBase {
    isToolbarInActiveTab(toolbarName, dashboardState) {
        if (!dashboardState) {
            return false;
        }
        const tabIndex = dashboardState.ActiveTabIndex;
        if (tabIndex != undefined) {
            if (dashboardState?.Tabs && dashboardState?.Tabs?.length > 0) {
                const newTab = dashboardState?.Tabs[tabIndex];
                if (newTab && newTab.Toolbars) {
                    return newTab.Toolbars.find((c) => c == toolbarName) != undefined;
                }
            }
        }
        return false;
    }
    isToolbarCustom(toolbarName) {
        return this.getAdaptableApi()
            .dashboardApi.getCustomToolbars()
            .some((tb) => tb.name === toolbarName);
    }
    getCustomToolbarRenderContainerId(customToolbarName) {
        return `ab-CustomToolbar__${customToolbarName}__renderContent`;
    }
    getCustomToolbarButtonsContainerId(customToolbarName) {
        return `ab-CustomToolbar__${customToolbarName}__buttons`;
    }
    getCustomToolbarComponentContainerId(customToolbarName) {
        return `ab-CustomToolbar__${customToolbarName}__component`;
    }
    getModuleToolbars() {
        const moduleService = this.getAdaptableInternalApi().getModuleService();
        return ALL_TOOLBARS.filter((moduleName) => {
            return moduleService.isModuleAvailable(moduleName);
        }).map((moduleName) => {
            return {
                id: moduleName,
                friendlyName: moduleService.getModuleInfoByModule(moduleName)?.FriendlyName ?? moduleName,
            };
        });
    }
}
