import { createStore, createLogger } from 'vuex';
import { store as main } from '@/store/modules/main';
import { store as machines } from '@/store/modules/machines';
import { store as layoutMachines } from '@/store/modules/layoutMachines';
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 last_packs } from '@/store/modules/last_packs';
import { store as last_packs_num } from '@/store/modules/last_packs_num';
import { store as packs } from '@/store/modules/packs';
import { store as services } from '@/store/modules/services';
import { store as logger } from '@/store/modules/logger';

let debug = process.env.NODE_ENV !== 'production';
debug = false;

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


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

export function useStore() {
  return store;
}
