"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseCommand_1 = require("../../BaseCommand");
const core_1 = require("@oclif/core");
class ListArchiveCards extends BaseCommand_1.BaseCommand {
    constructor() {
        super(...arguments);
        this.defaultOutput = "fancy";
    }
    async run() {
        const result = await this.client.lists.archiveAllCardsInList({
            id: this.lookups.list,
        });
        this.output(result);
    }
    toData(data) {
        if (!Array.isArray(data)) {
            return [];
        }
        return data.map((card) => ({
            id: card.id,
            name: card.name,
        }));
    }
    async format(data) {
        if (!Array.isArray(data) || data.length === 0) {
            return "No cards archived";
        }
        return `${data.length} ${data.length === 1 ? "card" : "cards"} archived`;
    }
}
ListArchiveCards.description = "Archive all cards in a list";
ListArchiveCards.flags = {
    board: core_1.Flags.string({ required: true }),
    list: core_1.Flags.string({ required: true }),
};
exports.default = ListArchiveCards;
