import { createStore, createLogger } from 'vuex';
import { store as main } from '@/store/modules/main';
import { store as machines } from '@/store/modules/machines';
import { store as layout_machines } from '@/store/modules/layout_machines';
import { store as finder_packs } from '@/store/modules/finder_packs';
import { store as add_users } from '@/store/modules/add_users';
import { store as layout } from '@/store/modules/layout';
import { store as auth } from '@/store/modules/auth';
import { store as packs } from '@/store/modules/packs';
import { store as services } from '@/store/modules/services';
import { store as logger } from '@/store/modules/logger';

// eslint-disable-next-line no-undef
let debug = process.env.NODE_ENV !== 'production';
debug = false;

const plugins = debug ? [createLogger({})] : [];


export const store = createStore({
  plugins,
  modules: {
    main,
    layout_machines,
    machines,
    finder_packs,
    add_users,
    layout,
    auth,
    packs,
    services,
    logger,
  },
});

export function useStore() {
  return store;
}
