// 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 RelayCommandDefinition_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 { BaseCommandDefinition } from './base-command-definition.js';
import { CommandBuilder, CommandGroup, Subcommand } from '../../core/command-path-builders/command-builder.js';
import { RelayCommand } from '../relay.js';
import * as constants from '../../core/constants.js';
let RelayCommandDefinition = class RelayCommandDefinition extends BaseCommandDefinition {
    static { RelayCommandDefinition_1 = this; }
    logger;
    relayCommand;
    constructor(logger, relayCommand) {
        super();
        this.logger = logger;
        this.relayCommand = relayCommand;
        this.relayCommand = patchInject(relayCommand, InjectTokens.RelayCommand, this.constructor.name);
        this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
    }
    static COMMAND_NAME = 'relay';
    static DESCRIPTION = 'RPC Relay 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 = 'List, create, manage, or destroy relay node instances. Operates on a single relay node instance at a time.';
    static NODE_ADD = 'add';
    static NODE_DESTROY = 'destroy';
    static NODE_UPGRADE = 'upgrade';
    static ADD_COMMAND = `${RelayCommandDefinition_1.COMMAND_NAME} ${RelayCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${RelayCommandDefinition_1.NODE_ADD}`;
    static DESTROY_COMMAND = `${RelayCommandDefinition_1.COMMAND_NAME} ${RelayCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${RelayCommandDefinition_1.NODE_DESTROY}`;
    static UPGRADE_COMMAND = `${RelayCommandDefinition_1.COMMAND_NAME} ${RelayCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${RelayCommandDefinition_1.NODE_UPGRADE}`;
    getCommandDefinition() {
        return new CommandBuilder(RelayCommandDefinition_1.COMMAND_NAME, RelayCommandDefinition_1.DESCRIPTION, this.logger)
            .addCommandGroup(new CommandGroup(RelayCommandDefinition_1.NODE_SUBCOMMAND_NAME, RelayCommandDefinition_1.NODE_SUBCOMMAND_DESCRIPTION)
            .addSubcommand(new Subcommand(RelayCommandDefinition_1.NODE_ADD, 'Adds and configures a new node instance.', this.relayCommand, this.relayCommand.add, RelayCommand.DEPLOY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))
            .addSubcommand(new Subcommand(RelayCommandDefinition_1.NODE_DESTROY, 'Deletes the specified node from the deployment.', this.relayCommand, this.relayCommand.destroy, RelayCommand.DESTROY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))
            .addSubcommand(new Subcommand(RelayCommandDefinition_1.NODE_UPGRADE, 'Upgrades the specified node from the deployment.', this.relayCommand, this.relayCommand.upgrade, RelayCommand.UPGRADE_FLAGS_LIST, [...constants.BASE_DEPENDENCIES])))
            .build();
    }
};
RelayCommandDefinition = RelayCommandDefinition_1 = __decorate([
    injectable(),
    __param(0, inject(InjectTokens.SoloLogger)),
    __param(1, inject(InjectTokens.RelayCommand)),
    __metadata("design:paramtypes", [Object, RelayCommand])
], RelayCommandDefinition);
export { RelayCommandDefinition };
//# sourceMappingURL=relay-command-definition.js.map