// config/version-defaults.ts — Central registry loader for default-versions.json
// All hardcoded versions in the codebase are sourced from this file.
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { join, dirname } from 'node:path';
const FALLBACK = {
    docker: {},
    terraform: {},
    npm: {},
    jvm: {},
    scala: {},
    elixir: {},
    dart: {},
    rust: {},
    cdn: {},
    standards: {},
};
function loadDefaults() {
    try {
        const dir = dirname(fileURLToPath(import.meta.url));
        const raw = readFileSync(join(dir, 'default-versions.json'), 'utf-8');
        return JSON.parse(raw);
    }
    catch {
        return FALLBACK;
    }
}
const defaults = loadDefaults();
export function getDockerTag(service) {
    return defaults.docker[service]?.tag ?? 'latest';
}
export function getTerraformVersion(resource) {
    return defaults.terraform[resource]?.version ?? '';
}
export function getNpmVersion(pkg) {
    return defaults.npm[pkg]?.version ?? 'latest';
}
export function getJvmVersion(lib) {
    return defaults.jvm[lib]?.version ?? '';
}
export function getScalaVersion(tool) {
    return defaults.scala[tool]?.version ?? '';
}
export function getElixirVersion(dep) {
    return defaults.elixir[dep]?.version ?? '';
}
export function getDartVersion(pkg) {
    return defaults.dart[pkg]?.version ?? '';
}
export function getRustVersion(crate) {
    return defaults.rust[crate]?.version ?? '';
}
export function getCdnUrl(name) {
    const entry = defaults.cdn[name];
    if (!entry) {
        return '';
    }
    return entry.baseUrl.replace('{version}', entry.version);
}
export function getStandardVersion(name) {
    return defaults.standards?.[name]?.version ?? '';
}
//# sourceMappingURL=version-defaults.js.map