// store API
import { mainStore } from './main';
import {
    useStoreValue as useStoreValueOriginal,
    useStoreState as useStoreStateOriginal,
    useTracked
} from 'zustand-x';

// Hook. Subscribe to single store value with arguments
export const useStoreValue = (key, ...args) => useStoreValueOriginal(mainStore, key, ...args);

// Hook. Subscribe to the whole store (use ONLY if really needed (probably will not be needed though!))
export const useStoreState = (key, ...args) => useStoreStateOriginal(mainStore, key, ...args);

// Hook. Subscribe to single store value no arguments
export const useTrackedValue = (key) => useTracked(mainStore, key);

// NOT hook. Get store value.
export const storeGet = (key, ...args) => mainStore.get(key, ...args);

// NOT hook. Set store value
export const storeSet = (key, ...args) => mainStore.set(key, ...args);

export default mainStore;