"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const chalk_1 = __importDefault(require("chalk"));
const backup_client_1 = require("../../../lib/backup-client");
const context_banner_1 = require("../../../lib/context-banner");
class BackupRestoreList extends core_1.Command {
    async run() {
        const { flags } = await this.parse(BackupRestoreList);
        (0, context_banner_1.printContextBanner)();
        const client = backup_client_1.BackupClient.fromConfig();
        const items = await client.listRestores();
        if (flags.json) {
            this.log(JSON.stringify(items, null, 2));
            return;
        }
        if (items.length === 0) {
            this.log(chalk_1.default.yellow('\n   No restore jobs.\n'));
            return;
        }
        this.log('');
        for (const r of items) {
            this.log(`   ${chalk_1.default.cyan(r.id)}  ${r.status}  kind=${r.targetKind}  cluster=${r.targetClusterId}`);
        }
        this.log('');
    }
}
BackupRestoreList.description = 'List restore jobs';
BackupRestoreList.flags = { json: core_1.Flags.boolean({ default: false }) };
exports.default = BackupRestoreList;
