"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 BackupDestinationShow extends core_1.Command {
    async run() {
        const { args, flags } = await this.parse(BackupDestinationShow);
        (0, context_banner_1.printContextBanner)();
        const client = backup_client_1.BackupClient.fromConfig();
        const d = await client.getDestination(args.id);
        if (flags.json) {
            this.log(JSON.stringify(d, null, 2));
            return;
        }
        this.log('');
        this.log(`   ${chalk_1.default.bold('ID:')}         ${d.id}`);
        this.log(`   ${chalk_1.default.bold('Name:')}       ${d.name}`);
        this.log(`   ${chalk_1.default.bold('Provider:')}   ${d.provider}`);
        this.log(`   ${chalk_1.default.bold('Endpoint:')}   ${d.endpoint}`);
        this.log(`   ${chalk_1.default.bold('Region:')}     ${d.region}`);
        this.log(`   ${chalk_1.default.bold('Bucket:')}     ${d.bucket}`);
        if (d.pathPrefix)
            this.log(`   ${chalk_1.default.bold('Prefix:')}     ${d.pathPrefix}`);
        if (d.encryptionMode)
            this.log(`   ${chalk_1.default.bold('Encryption:')} ${d.encryptionMode}`);
        if (d.health)
            this.log(`   ${chalk_1.default.bold('Health:')}     ${d.health}`);
        if (typeof d.usageBytes === 'number')
            this.log(`   ${chalk_1.default.bold('Usage:')}      ${(d.usageBytes / 1024 ** 3).toFixed(2)} GB`);
        this.log('');
    }
}
BackupDestinationShow.description = 'Show a backup destination by ID';
BackupDestinationShow.args = {
    id: core_1.Args.string({ required: true, description: 'Destination ID (UUID)' }),
};
BackupDestinationShow.flags = {
    json: core_1.Flags.boolean({ description: 'Output as JSON', default: false }),
};
exports.default = BackupDestinationShow;
