"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseCommand_1 = require("../../BaseCommand");
const core_1 = require("@oclif/core");
class CardAttachments extends BaseCommand_1.BaseCommand {
    constructor() {
        super(...arguments);
        this.defaultOutput = "fancy";
    }
    async run() {
        const attachments = await this.client.cards.getCardAttachments({
            id: this.lookups.card,
        });
        this.output(attachments);
    }
    toData(data) {
        return data.map((a) => ({
            id: a.id,
            name: a.name,
            url: a.url,
            date: a.date,
        }));
    }
    async format(data) {
        if (data.length === 0) {
            return "No attachments";
        }
        return data
            .map((a) => `${a.name} (${a.url})`)
            .join("\n");
    }
}
CardAttachments.description = "List attachments on a card";
CardAttachments.flags = {
    board: core_1.Flags.string({ required: true }),
    list: core_1.Flags.string({ required: true }),
    card: core_1.Flags.string({ required: true }),
};
exports.default = CardAttachments;
