/*---------------------------------------------------------------------------------------------
 * 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
 */
import { ActionButtonItemDef } from "./ActionButtonItemDef";
/** An Item that executes a Command.
 * @public
 */
class CommandItemDef extends 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-";
export { CommandItemDef };
//# sourceMappingURL=CommandItemDef.js.map