// 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 BackupRestoreCommandDefinition_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 { BackupRestoreCommand } from '../backup-restore.js';
let BackupRestoreCommandDefinition = class BackupRestoreCommandDefinition extends BaseCommandDefinition {
    static { BackupRestoreCommandDefinition_1 = this; }
    logger;
    backupRestoreCommand;
    constructor(logger, backupRestoreCommand) {
        super();
        this.logger = logger;
        this.backupRestoreCommand = backupRestoreCommand;
        this.backupRestoreCommand = patchInject(backupRestoreCommand, InjectTokens.BackupRestoreCommand, this.constructor.name);
        this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
    }
    static COMMAND_NAME = 'config';
    static DESCRIPTION = 'Backup and restore component configurations for Solo deployments. ' +
        'These commands display what would be backed up or restored without performing actual operations.';
    static SUBCOMMAND_NAME = 'ops';
    static SUBCOMMAND_DESCRIPTION = 'Configuration backup and restore operations';
    static BACKUP_COMMAND = 'backup';
    static RESTORE_CONFIG_COMMAND = 'restore-config';
    static RESTORE_CLUSTERS_COMMAND = 'restore-clusters';
    static RESTORE_NETWORK_COMMAND = 'restore-network';
    getCommandDefinition() {
        return new CommandBuilder(BackupRestoreCommandDefinition_1.COMMAND_NAME, BackupRestoreCommandDefinition_1.DESCRIPTION, this.logger)
            .addCommandGroup(new CommandGroup(BackupRestoreCommandDefinition_1.SUBCOMMAND_NAME, BackupRestoreCommandDefinition_1.SUBCOMMAND_DESCRIPTION)
            .addSubcommand(new Subcommand(BackupRestoreCommandDefinition_1.BACKUP_COMMAND, 'Display backup plan for all component configurations of a deployment. ' +
            'Shows what files and configurations would be backed up without performing the actual backup.', this.backupRestoreCommand, this.backupRestoreCommand.backup, BackupRestoreCommand.BACKUP_FLAGS_LIST, []))
            .addSubcommand(new Subcommand(BackupRestoreCommandDefinition_1.RESTORE_CONFIG_COMMAND, 'Restore component configurations from backup. ' +
            'Imports ConfigMaps, Secrets, logs, and state files for a running deployment.', this.backupRestoreCommand, this.backupRestoreCommand.restoreConfig, BackupRestoreCommand.RESTORE_CONFIG_FLAGS_LIST, []))
            .addSubcommand(new Subcommand(BackupRestoreCommandDefinition_1.RESTORE_CLUSTERS_COMMAND, 'Restore Kind clusters from backup directory structure. ' +
            'Creates clusters, sets up Docker network, installs MetalLB, and initializes cluster configurations. ' +
            'Does not deploy network components.', this.backupRestoreCommand, this.backupRestoreCommand.restoreClusters, BackupRestoreCommand.RESTORE_CLUSTERS_FLAGS_LIST, []))
            .addSubcommand(new Subcommand(BackupRestoreCommandDefinition_1.RESTORE_NETWORK_COMMAND, 'Deploy network components to existing clusters from backup. ' +
            'Deploys consensus nodes, block nodes, mirror nodes, explorers, and relay nodes. ' +
            'Requires clusters to be already created (use restore-clusters first).', this.backupRestoreCommand, this.backupRestoreCommand.restoreNetwork, BackupRestoreCommand.RESTORE_NETWORK_FLAGS_LIST, [])))
            .build();
    }
};
BackupRestoreCommandDefinition = BackupRestoreCommandDefinition_1 = __decorate([
    injectable(),
    __param(0, inject(InjectTokens.SoloLogger)),
    __param(1, inject(InjectTokens.BackupRestoreCommand)),
    __metadata("design:paramtypes", [Object, BackupRestoreCommand])
], BackupRestoreCommandDefinition);
export { BackupRestoreCommandDefinition };
//# sourceMappingURL=backup-restore-command-definition.js.map