"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 Backstage
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackstageItemUtilities = void 0;
const PropsHelper_1 = require("../utils/PropsHelper");
const BackstageItem_1 = require("./BackstageItem");
/** Utilities for creating and maintaining backstage items
 * @beta
 */
class BackstageItemUtilities {
}
exports.BackstageItemUtilities = BackstageItemUtilities;
/** Creates a stage launcher backstage item. */
BackstageItemUtilities.createStageLauncher = (frontstageId, groupPriority, itemPriority, label, subtitle, iconSpec, overrides) => ({
    groupPriority,
    icon: iconSpec,
    id: frontstageId,
    itemPriority,
    type: BackstageItem_1.BackstageItemType.StageLauncher,
    label,
    stageId: frontstageId,
    subtitle,
    ...overrides,
});
/** Creates an action backstage item. */
BackstageItemUtilities.createActionItem = (itemId, groupPriority, itemPriority, execute, label, subtitle, iconSpec, overrides) => ({
    execute,
    groupPriority,
    icon: iconSpec,
    id: itemId,
    itemPriority,
    type: BackstageItem_1.BackstageItemType.ActionItem,
    label,
    subtitle,
    ...overrides,
});
/** Helper method to set backstage item state from props.
 * @deprecated in 3.6. UI 1.0 will be removed in AppUi 4.0.
 */
BackstageItemUtilities.getBackstageItemStateFromProps = (props) => {
    const labelSpec = PropsHelper_1.PropsHelper.getStringSpec(props.label, props.labelKey);
    const subtitleSpec = PropsHelper_1.PropsHelper.getStringSpec(props.description, props.descriptionKey);
    const tooltipSpec = PropsHelper_1.PropsHelper.getStringSpec(props.tooltip, props.tooltipKey);
    return {
        isEnabled: undefined !== props.isEnabled ? props.isEnabled : /* istanbul ignore next */ false,
        label: PropsHelper_1.PropsHelper.getStringFromSpec(labelSpec),
        subtitle: PropsHelper_1.PropsHelper.getStringFromSpec(subtitleSpec),
        tooltip: PropsHelper_1.PropsHelper.getStringFromSpec(tooltipSpec),
        iconSpec: props.iconSpec,
        isActive: undefined !== props.isActive ? props.isActive : false,
    };
};
//# sourceMappingURL=BackstageItemUtilities.js.map