"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseCommand_1 = require("../../BaseCommand");
const core_1 = require("@oclif/core");
class Show extends BaseCommand_1.BaseCommand {
    constructor() {
        super(...arguments);
        this.defaultOutput = "fancy";
    }
    async run() {
        const card = await this.client.cards.getCard({
            id: this.lookups.card,
        });
        this.output(card);
    }
    async toData(data) {
        return {
            id: data.id,
            name: data.name,
            due: data.due,
            description: data.desc,
            labels: data.labels,
            url: data.url,
            members: await this.cache.convertMemberIdsToEntity(data.idMembers),
        };
    }
    async format(data) {
        var _a, _b;
        const labels = ((_a = data.labels) === null || _a === void 0 ? void 0 : _a.map((l) => l.name).join(", ")) || "None";
        const members = ((_b = data.members) === null || _b === void 0 ? void 0 : _b.map((m) => m.fullName).join(", ")) || "None";
        const lines = [
            `Name: ${data.name}`,
            `ID: ${data.id}`,
            `URL: ${data.url}`,
            `Due: ${data.due || "None"}`,
            `Labels: ${labels}`,
            `Members: ${members}`,
            `Description: ${data.description || "None"}`,
        ];
        return lines.join("\n");
    }
}
Show.description = "Show card details";
Show.flags = {
    card: core_1.Flags.string({ required: true }),
    board: core_1.Flags.string({ required: true }),
    list: core_1.Flags.string({ required: true }),
};
exports.default = Show;
