import { join } from 'node:path';
import { resolveHappyHomeDirFromEnvironment } from '../providers/resolveHappyHomeDir.js';
import { resolveFirstPartyComponentPublicReleaseVariant, } from './componentCatalog.js';
export function resolveFirstPartyInstallLayout(params) {
    const processEnv = params.processEnv ?? process.env;
    const channel = params.channel ?? params.releaseRing ?? 'stable';
    const component = resolveFirstPartyComponentPublicReleaseVariant({
        componentId: params.componentId,
        channel,
    });
    const happyHomeDir = resolveHappyHomeDirFromEnvironment(processEnv);
    const installRoot = join(happyHomeDir, component.installRootName);
    return {
        componentId: params.componentId,
        channel,
        installRootName: component.installRootName,
        installShims: component.installShims,
        happyHomeDir,
        installRoot,
        versionsDir: join(installRoot, 'versions'),
        currentPath: join(installRoot, 'current'),
        previousPath: join(installRoot, 'previous'),
        shimDir: join(happyHomeDir, 'bin'),
    };
}
export function resolveFirstPartyVersionInstallPath(params) {
    const layout = resolveFirstPartyInstallLayout({
        componentId: params.componentId,
        channel: params.channel,
        releaseRing: params.releaseRing,
        processEnv: params.processEnv,
    });
    return join(layout.versionsDir, params.versionId);
}
//# sourceMappingURL=installLayout.js.map