import Vuex from 'vuex'
import vuexI18n from 'vuex-i18n'
import VueApexCharts from 'vue-apexcharts'
import VueCurrencyFilter from 'vue-currency-filter'
import Vuelidate from 'vuelidate'
import VueShortcuts from 'vue-shortcuts'
import Pusher from 'pusher-js'
import BootstrapVue from 'bootstrap-vue'
import VueProgressBar from 'vue-progressbar'
import Vuemerang from 'vuemerang'

import Locales from '@/lang/vue-i18n-locales.generated'

export default function configStore (Vue, storeMock) {
  Vue.use(Vuex)
  window.Pusher = Pusher

  const store = new Vuex.Store(storeMock)
  const options = {
    color: '#6c4197',
    failedColor: 'rgb(242, 19, 93)',
    thickness: '2px',
    transition: {
      speed: '1.5s',
      opacity: '0.6s',
      termination: 300
    },
    autoRevert: true,
    location: 'top',
    inverse: false
  }

  Vue.use(VueShortcuts, { prevent: ['input'] })

  Vue.use(VueCurrencyFilter,
    {
      symbol: '$',
      thousandsSeparator: ',',
      fractionCount: 2,
      fractionSeparator: '.',
      symbolPosition: 'front',
      symbolSpacing: false
    })

  Vue.use(vuexI18n.plugin, store)
  Vue.use(BootstrapVue)
  Vue.use(VueApexCharts)
  Vue.component('apexchart', VueApexCharts)
  Vue.use(Vuemerang)
  Vue.use(Vuelidate)
  Vue.use(VueProgressBar, options)

  Vue.i18n.add('en', Locales.en)
  Vue.i18n.add('es', Locales.es)

  Vue.i18n.set('es')

  return store
}
