import { createStore } from '@genesislcap/foundation-redux';
import { aiAssistantSlice, defaultSessionState, } from './ai-assistant-slice';
const sessionStores = new Map();
function makeStore(devTools) {
    return createStore([aiAssistantSlice], { aiAssistant: defaultSessionState }, devTools !== undefined ? { devTools } : undefined);
}
/**
 * Returns the session store for the given key, creating one if it does not
 * already exist. Omit `devTools` (or pass `undefined`) to defer to `isDev()`.
 * Pass `true` to force-enable or `false` to force-disable Redux DevTools.
 */
export function getSessionStore(key, devTools) {
    const existing = sessionStores.get(key);
    if (existing)
        return existing;
    const created = makeStore(devTools);
    sessionStores.set(key, created);
    return created;
}
/**
 * Returns true if a session store already exists for the given key.
 */
export function hasSessionStore(key) {
    return sessionStores.has(key);
}
/**
 * Deletes the session store for the given key.
 */
export function deleteSessionStore(key) {
    sessionStores.delete(key);
}
/**
 * Removes all session stores. Exposed for test isolation only — not part of the public API.
 *
 * @internal
 */
export function clearAllSessionStores() {
    sessionStores.clear();
}
