import { defineComponent, ref, onMounted, watch, computed } from 'vue'

import { useGlobalStore } from '@store/globalStore'
import { useRoute } from 'vue-router'
import { useUserStore } from '@store/UserStore'

import { tools } from '@src/store/Modules/tools'
import { static_data } from '@src/db/static_data'
import { toolsext } from '@src/store/Modules/toolsext'

import { CMyPageElem } from '@src/components/CMyPageElem'
import MixinBase from '@src/mixins/mixin-base'
import MixinMetaTags from '@src/mixins/mixin-metatags'
import { useMeta } from 'quasar'
import { useI18n } from 'vue-i18n'


export default defineComponent({
  name: 'Home',
  components: { CMyPageElem },
  setup() {

    const userStore = useUserStore()
    const globalStore = useGlobalStore()
    const { t } = useI18n()

    const isfinishLoading = computed(() => globalStore.finishLoading)

    const { getMeta } = MixinMetaTags()

    const { setValDb, getValDb } = MixinBase()

    function inizia() {
      if (globalStore.site) {
        useMeta(getMeta({
          title: globalStore.site.name,
          description: globalStore.site.description,
          keywords: globalStore.site.keywords,
        }, t))
      }
    }

    inizia()

    return {
      tools,
      toolsext,
      static_data,
      getValDb,
      globalStore,
      isfinishLoading,
    }

  },
})
