"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseCommand_1 = require("../../BaseCommand");
const core_1 = require("@oclif/core");
class CardAttach extends BaseCommand_1.BaseCommand {
    async run() {
        const params = {
            id: this.lookups.card,
            url: this.flags.url,
        };
        if (this.flags.name) {
            params.name = this.flags.name;
        }
        const attachment = await this.client.cards.createCardAttachment(params);
        this.output(attachment);
    }
    toData(data) {
        return {
            id: data.id,
            name: data.name,
            url: data.url,
        };
    }
}
CardAttach.description = "Add an attachment to a card";
CardAttach.flags = {
    board: core_1.Flags.string({ required: true }),
    list: core_1.Flags.string({ required: true }),
    card: core_1.Flags.string({ required: true }),
    url: core_1.Flags.string({ required: true }),
    name: core_1.Flags.string(),
};
exports.default = CardAttach;
