function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
export class SettingsCache {
    getCacheKey(facilityId) {
        return facilityId ?? 'central';
    }
    getAllSettings(facilityId) {
        return this.allSettingsCache.get(this.getCacheKey(facilityId)) ?? null;
    }
    setAllSettings(value, facilityId) {
        this.allSettingsCache.set(this.getCacheKey(facilityId), value);
    }
    reset(facilityId) {
        if (facilityId === undefined) {
            this.allSettingsCache.clear();
        } else {
            this.allSettingsCache.delete(this.getCacheKey(facilityId));
        }
    }
    // No-arg form returns whether ANY bucket is cached (used by tests).
    has(facilityId) {
        if (facilityId === undefined) {
            return this.allSettingsCache.size > 0;
        }
        return this.allSettingsCache.has(this.getCacheKey(facilityId));
    }
    constructor(){
        // Map of facilityId (or 'central' for no facility) to cache objects.
        // Invalidated by the settings-table NOTIFY listener; no TTL.
        _define_property(this, "allSettingsCache", new Map());
    }
}
export const settingsCache = new SettingsCache();

//# sourceMappingURL=settingsCache.js.map