export async function checkVersion(input, dependencies) {
    const { cache, installTypeDetector } = dependencies;
    if (!input.forceRefresh && !cache.isExpired()) {
        const cached = cache.get();
        if (cached !== null) {
            return cached;
        }
    }
    const latestVersion = await dependencies.packageVersionGateway.fetchLatestVersion();
    const updateAvailable = latestVersion !== null && latestVersion !== input.currentVersion;
    const result = {
        currentVersion: input.currentVersion,
        latestVersion,
        updateAvailable,
        checkedAt: new Date().toISOString(),
        installType: installTypeDetector.detect(),
    };
    cache.set(result);
    return result;
}
//# sourceMappingURL=checkVersion.usecase.js.map