import { computed, defineComponent } from 'vue'

import { useUserStore } from '../../store/UserStore'
import { useRouter } from 'vue-router'
import { useGlobalStore } from '../../store/globalStore'
import { useI18n } from 'vue-i18n'

import { shared_consts } from '@src/common/shared_vuejs'
import type { IMainCard } from '@costanti';
import { costanti } from '@costanti'

import { tools } from '@tools'

export default defineComponent({
  name: 'CDashboard',
  props: {},
  setup(props) {

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

    const calcstat = computed(() => userStore.my.calcstat ? userStore.my.calcstat : {
      numUsersReg: 0,
      numByTab: {},
    })

    const visustat = computed(() => {
      // @ts-ignore
      return costanti.MAINCARDS.filter((rec: IMainCard) => rec.visuonstat && !rec.forgroup)
    })

    const visulinks = computed(() => {
      // @ts-ignore
      return costanti.MAINCARDS.filter((rec: IMainCard) => rec.link && !rec.forgroup)
    })

    return {
      userStore,
      tools,
      calcstat,
      shared_consts,
      visustat,
      visulinks,
    }
  },
})
