"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module StandardUiItemsProvider
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardNavigationToolsProvider = void 0;
const appui_abstract_1 = require("@itwin/appui-abstract");
const ToolbarHelper_1 = require("../toolbar/ToolbarHelper");
const CoreToolDefinitions_1 = require("../tools/CoreToolDefinitions");
/* eslint-disable deprecation/deprecation */
/**
 * Provide standard tools for the ViewNavigationWidgetComposer.
 * @public
 */
class StandardNavigationToolsProvider extends appui_abstract_1.BaseUiItemsProvider {
    constructor(providerId, defaultNavigationTools, isSupportedStage) {
        super(providerId, isSupportedStage);
        this.defaultNavigationTools = defaultNavigationTools;
    }
    /**
     * static function to register the StandardContentToolsProvider
     * @param providerId - unique identifier for this instance of the provider. This is required in case separate packages want
     * to set up custom stage with their own subset of standard tools
     * @param defaultNavigationTools - if undefined all available tools are provided to stage. If defined only those
     * specific tool buttons are shown.
     * @param isSupportedStage - optional function that will be called to determine if tools should be added to current stage. If not set and
     * the current stage's `usage` is set to `StageUsage.General` then the provider will add items to frontstage.
     */
    static register(providerId, defaultNavigationTools, isSupportedStage) {
        const provider = new StandardNavigationToolsProvider(providerId, defaultNavigationTools, isSupportedStage);
        appui_abstract_1.UiItemsManager.register(provider);
        return provider;
    }
    provideToolbarButtonItemsInternal(_stageId, _stageUsage, toolbarUsage, toolbarOrientation, _stageAppData) {
        const items = [];
        if (toolbarUsage === appui_abstract_1.ToolbarUsage.ViewNavigation && toolbarOrientation === appui_abstract_1.ToolbarOrientation.Horizontal) {
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.horizontal || this.defaultNavigationTools.horizontal.rotateView)
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(10, CoreToolDefinitions_1.CoreTools.rotateViewCommand));
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.horizontal || this.defaultNavigationTools.horizontal.panView)
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(20, CoreToolDefinitions_1.CoreTools.panViewCommand));
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.horizontal || this.defaultNavigationTools.horizontal.fitView) {
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(30, CoreToolDefinitions_1.CoreTools.fitViewCommand));
            }
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.horizontal || this.defaultNavigationTools.horizontal.windowArea) {
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(40, CoreToolDefinitions_1.CoreTools.windowAreaCommand));
            }
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.horizontal || this.defaultNavigationTools.horizontal.viewUndoRedo) {
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(50, CoreToolDefinitions_1.CoreTools.viewUndoCommand));
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(60, CoreToolDefinitions_1.CoreTools.viewRedoCommand));
            }
        }
        else if (toolbarUsage === appui_abstract_1.ToolbarUsage.ViewNavigation && toolbarOrientation === appui_abstract_1.ToolbarOrientation.Vertical) {
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.vertical || this.defaultNavigationTools.vertical.setupWalkCamera)
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(5, CoreToolDefinitions_1.CoreTools.setupCameraWalkTool));
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.vertical || this.defaultNavigationTools.vertical.walk)
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(10, CoreToolDefinitions_1.CoreTools.walkViewCommand));
            if (!this.defaultNavigationTools || !this.defaultNavigationTools.vertical || this.defaultNavigationTools.vertical.toggleCamera)
                items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(20, CoreToolDefinitions_1.CoreTools.toggleCameraViewCommand));
        }
        return items;
    }
}
exports.StandardNavigationToolsProvider = StandardNavigationToolsProvider;
//# sourceMappingURL=StandardNavigationToolsProvider.js.map