import { createApiClient } from "../../common/api/client.js";
import { printResultToConsole } from "../../common/output.js";
export async function describe(argv) {
    const { account, project } = argv;
    const certId = argv["cert-id"];
    const client = createApiClient({ authToken: argv.authToken });
    const cert = await client.get(`/v1/accounts/${account}/projects/${project}/mtls-certificates/${encodeURIComponent(certId)}`, {
        operation: "Failed to describe mTLS certificate",
        errorMessage: "Error: Failed to describe mTLS certificate.",
    });
    const envs = Object.entries(cert.environments)
        .filter(([, enabled]) => enabled)
        .map(([env]) => env)
        .join(", ");
    const subject = cert.certificateInfo.subject.replace(/\n/g, ", ");
    printResultToConsole(`  ID: ${cert.id}\n` +
        `  Name: ${cert.name}\n` +
        `  Subject: ${subject}\n` +
        `  Valid from: ${cert.certificateInfo.validFrom}\n` +
        `  Valid to: ${cert.certificateInfo.validTo}\n` +
        `  Environment types: ${envs}`);
}
//# sourceMappingURL=handler.js.map