"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.listUsers = listUsers;
exports.getUser = getUser;
const client_1 = require("../client");
const format_1 = require("../format");
const COLUMNS = [
    { key: 'id', label: 'ID', width: 12, format: (v) => v?.slice(0, 12) || '' },
    { key: 'external_id', label: 'Username', width: 20 },
    { key: 'display_name', label: 'Name', width: 20 },
    { key: 'status', label: 'Status', width: 10 },
];
async function listUsers(opts) {
    const data = await (0, client_1.apiFetch)('/users');
    const users = data.users || data;
    (0, format_1.output)(data, Array.isArray(users) ? users : [], COLUMNS, opts);
}
async function getUser(id, opts) {
    const data = await (0, client_1.apiFetch)(`/users/${id}`);
    if (opts.json) {
        console.log(JSON.stringify(data, null, 2));
        return;
    }
    console.log(JSON.stringify(data, null, 2));
}
