// #region Imports
// #endregion
/**
 * @public
 *
 * Represents a command that can be executed.
 */
export class Command {
    // #region Fields
    _executeMethod;
    _canExecuteMethod;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `Command` class.
     *
     * @public
     */
    constructor(executeMethod, canExecuteMethod) {
        this._executeMethod = executeMethod;
        this._canExecuteMethod = canExecuteMethod ?? (() => true);
    }
    // #endregion
    // #region Methods
    /**
     * Executes the command.
     *
     * @public
     * @param parameter - The parameter.
     */
    execute(parameter) {
        if (this._canExecuteMethod(parameter)) {
            this._executeMethod(parameter);
        }
    }
    /**
     * Determines whether the command can be executed.
     *
     * @public
     * @param parameter - The parameter.
     * @returns `true` if the command can be executed; otherwise, `false`.
     */
    canExecute(parameter) {
        return this._canExecuteMethod(parameter);
    }
}
//# sourceMappingURL=Command.js.map