/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Tools
 */
import { IModelApp, NotifyMessageDetails, OutputMessagePriority, Tool, } from "@itwin/core-frontend";
import { InternalFrontstageManager } from "../frontstage/InternalFrontstageManager";
import { UiFramework } from "../UiFramework";
import svgViewLayouts from "@bentley/icons-generic/icons/view-layouts.svg";
/**
 * Immediate tool that will reset the layout to that specified in the stage definition. A stage Id
 * may be passed in, if not the active stage is used. The stage Id is case sensitive.
 * @public
 */
export class RestoreFrontstageLayoutTool extends Tool {
    static get minArgs() {
        return 0;
    }
    static get maxArgs() {
        return 1;
    }
    async run(frontstageId) {
        let frontstageDef;
        if (frontstageId) {
            frontstageDef = await UiFramework.frontstages.getFrontstageDef(frontstageId);
        }
        else {
            frontstageDef = UiFramework.frontstages.activeFrontstageDef;
        }
        if (frontstageDef)
            frontstageDef.restoreLayout();
        else
            IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, UiFramework.translate("tools.RestoreFrontstageLayout.noStageFound")));
        return true;
    }
    async parseAndRun(...args) {
        return this.run(args[0]);
    }
}
RestoreFrontstageLayoutTool.toolId = "RestoreFrontstageLayout";
RestoreFrontstageLayoutTool.iconSpec = svgViewLayouts;
/**
 * Immediate tool that will reset the layout of all frontstages to that specified in the stage definition.
 * @public
 */
export class RestoreAllFrontstagesTool extends Tool {
    async run() {
        const frontstages = InternalFrontstageManager.frontstageDefs;
        for (const [, frontstage] of frontstages) {
            frontstage.restoreLayout();
        }
        return true;
    }
}
RestoreAllFrontstagesTool.toolId = "RestoreAllFrontstages";
RestoreAllFrontstagesTool.iconSpec = svgViewLayouts;
//# sourceMappingURL=RestoreLayoutTool.js.map