// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var BlockCommandDefinition_1;
import { inject, injectable } from 'tsyringe-neo';
import { InjectTokens } from '../../core/dependency-injection/inject-tokens.js';
import { patchInject } from '../../core/dependency-injection/container-helper.js';
import BlockNodeCommand from '../block-node.js';
import { BaseCommandDefinition } from './base-command-definition.js';
import { CommandBuilder, CommandGroup, Subcommand } from '../../core/command-path-builders/command-builder.js';
import * as constants from '../../core/constants.js';
let BlockCommandDefinition = class BlockCommandDefinition extends BaseCommandDefinition {
    static { BlockCommandDefinition_1 = this; }
    logger;
    blockNodeCommand;
    constructor(logger, blockNodeCommand) {
        super();
        this.logger = logger;
        this.blockNodeCommand = blockNodeCommand;
        this.blockNodeCommand = patchInject(blockNodeCommand, InjectTokens.BlockNodeCommand, this.constructor.name);
        this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
    }
    static COMMAND_NAME = 'block';
    static DESCRIPTION = 'Block Node operations for creating, modifying, and destroying resources. ' +
        'These commands require the presence of an existing deployment.';
    static NODE_SUBCOMMAND_NAME = 'node';
    static NODE_SUBCOMMAND_DESCRIPTION = 'Create, manage, or destroy block node instances. Operates on a single block node instance at a time.';
    static NODE_ADD = 'add';
    static NODE_DESTROY = 'destroy';
    static NODE_UPGRADE = 'upgrade';
    static NODE_ADD_EXTERNAL = 'add-external';
    static NODE_DELETE_EXTERNAL = 'delete-external';
    static ADD_COMMAND = `${BlockCommandDefinition_1.COMMAND_NAME} ${BlockCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${BlockCommandDefinition_1.NODE_ADD}`;
    static DESTROY_COMMAND = `${BlockCommandDefinition_1.COMMAND_NAME} ${BlockCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${BlockCommandDefinition_1.NODE_DESTROY}`;
    static UPGRADE_COMMAND = `${BlockCommandDefinition_1.COMMAND_NAME} ${BlockCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${BlockCommandDefinition_1.NODE_UPGRADE}`;
    getCommandDefinition() {
        return new CommandBuilder(BlockCommandDefinition_1.COMMAND_NAME, BlockCommandDefinition_1.DESCRIPTION, this.logger)
            .addCommandGroup(new CommandGroup(BlockCommandDefinition_1.NODE_SUBCOMMAND_NAME, BlockCommandDefinition_1.NODE_SUBCOMMAND_DESCRIPTION)
            .addSubcommand(new Subcommand(BlockCommandDefinition_1.NODE_ADD, 'Creates and configures a new block node instance for the specified ' +
            'deployment using the specified Kubernetes cluster. ' +
            'The cluster must be accessible and attached to the specified deployment.', this.blockNodeCommand, this.blockNodeCommand.add, BlockNodeCommand.ADD_FLAGS_LIST, [constants.HELM, constants.KUBECTL]))
            .addSubcommand(new Subcommand(BlockCommandDefinition_1.NODE_DESTROY, 'Destroys a single block node instance in the specified deployment. ' +
            'Requires access to all Kubernetes clusters attached to the deployment.', this.blockNodeCommand, this.blockNodeCommand.destroy, BlockNodeCommand.DESTROY_FLAGS_LIST, [constants.HELM, constants.KUBECTL]))
            .addSubcommand(new Subcommand(BlockCommandDefinition_1.NODE_UPGRADE, 'Upgrades a single block node instance in the specified deployment. ' +
            'Requires access to all Kubernetes clusters attached to the deployment.', this.blockNodeCommand, this.blockNodeCommand.upgrade, BlockNodeCommand.UPGRADE_FLAGS_LIST, [constants.HELM, constants.KUBECTL]))
            .addSubcommand(new Subcommand(BlockCommandDefinition_1.NODE_ADD_EXTERNAL, 'Add an external block node for the specified deployment. ' +
            'You can specify the priority and consensus nodes to which to connect or use the default settings.', this.blockNodeCommand, this.blockNodeCommand.addExternal, BlockNodeCommand.ADD_EXTERNAL_FLAGS_LIST, [constants.HELM, constants.KUBECTL]))
            .addSubcommand(new Subcommand(BlockCommandDefinition_1.NODE_DELETE_EXTERNAL, 'Deletes an external block node from the specified deployment.', this.blockNodeCommand, this.blockNodeCommand.deleteExternal, BlockNodeCommand.DELETE_EXTERNAL_FLAGS_LIST, [constants.HELM, constants.KUBECTL])))
            .build();
    }
};
BlockCommandDefinition = BlockCommandDefinition_1 = __decorate([
    injectable(),
    __param(0, inject(InjectTokens.SoloLogger)),
    __param(1, inject(InjectTokens.BlockNodeCommand)),
    __metadata("design:paramtypes", [Object, BlockNodeCommand])
], BlockCommandDefinition);
export { BlockCommandDefinition };
//# sourceMappingURL=block-command-definition.js.map