"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseCommand_1 = require("../../BaseCommand");
const core_1 = require("@oclif/core");
class AssignedTo extends BaseCommand_1.BaseCommand {
    constructor() {
        super(...arguments);
        this.defaultOutput = "fancy";
    }
    async run() {
        const cards = await this.client.members.getMemberCards({
            id: this.lookups.user,
        });
        this.output(cards);
    }
    toData(data) {
        return data;
    }
    async format(data) {
        return (await Promise.all(data.map(async (b) => {
            const board = await this.cache.getBoard(b.idBoard);
            const list = await this.cache.getList(b.idList);
            return `${b.name} (ID: ${b.id}, Board: ${board}, List: ${list})`;
        }))).join("\n");
    }
}
AssignedTo.description = "Show all cards assigned to a user (default 'me')";
AssignedTo.flags = {
    user: core_1.Flags.string({ default: "me" }),
};
exports.default = AssignedTo;
