"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 Item
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandItemDef = void 0;
const ActionButtonItemDef_1 = require("./ActionButtonItemDef");
/** An Item that executes a Command.
 * @public
 */
class CommandItemDef extends ActionButtonItemDef_1.ActionButtonItemDef {
    constructor(commandItemProps, onItemExecuted) {
        super(commandItemProps, onItemExecuted);
        this.commandId = "";
        if (commandItemProps.execute) {
            this._commandHandler = {
                execute: commandItemProps.execute,
                parameters: commandItemProps.parameters,
                getCommandArgs: commandItemProps.getCommandArgs,
            };
        }
        if (commandItemProps.commandId)
            this.commandId = commandItemProps.commandId;
        else {
            CommandItemDef._sId++;
            this.commandId = CommandItemDef.commandIdPrefix + CommandItemDef._sId;
        }
    }
    get id() {
        return this.commandId;
    }
}
CommandItemDef._sId = 0;
CommandItemDef.commandIdPrefix = "Command-";
exports.CommandItemDef = CommandItemDef;
//# sourceMappingURL=CommandItemDef.js.map