"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mablApiClientFactory_1 = require("@mablhq-internal/runtime/api/mablApiClientFactory");
const describe_1 = require("../../commandUtil/describe");
const util_1 = require("../../commandUtil/util");
const cliUtil_1 = require("@mablhq-internal/runtime/core/cliUtil");
exports.command = 'describe <id>';
exports.describe = (0, util_1.getDescribeDescriptions)('workspace');
exports.builder = (0, describe_1.getDescribeBuilderOptions)();
exports.handler = (0, cliUtil_1.failWrapper)(getWorkspace);
async function getWorkspace(parsed) {
    try {
        const workspaceId = parsed.id;
        const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
        const workspace = await apiClient.getWorkspace(workspaceId);
        (0, describe_1.outputEntity)(workspace, parsed.output);
        return workspace.id;
    }
    catch (error) {
        throw new Error(`Error getting workspace: ${error}`);
    }
}
