import { CMyFieldDb } from '@src/components/CMyFieldDb'
import { CTitleBanner } from '@src/components/CTitleBanner'
import { CProfile } from '@src/components/CProfile'
import { CDateTime } from '@src/components/CDateTime'
import { CMyPage } from '@src/components/CMyPage'
import { CMyCardPopup } from '@src/components/CMyCardPopup'
import { CCheckIfIsLogged } from '@src/components/CCheckIfIsLogged'
import { CMyCardService } from '@src/components/CMyCardService'
import { tools } from '@tools'
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
import { useUserStore } from '@store/UserStore'
import { useRoute, useRouter } from 'vue-router'
import { useGlobalStore } from '@store/globalStore'
import { useI18n } from 'vue-i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import type { IMySkill } from 'model';
import { IUserFields } from 'model'
import { shared_consts } from '@src/common/shared_vuejs'
import { fieldsTable } from '@store/Modules/fieldsTable'

import { colCitys } from '@store/Modules/fieldsTable'


export default defineComponent({
  name: 'myservice',
  components: { CProfile, CTitleBanner, CMyFieldDb, CMyCardService, CDateTime, CMyPage, CCheckIfIsLogged, CMyCardPopup },
  props: {},
  setup() {
    const userStore = useUserStore()
    const globalStore = useGlobalStore()
    const $route = useRoute()
    const $q = useQuasar()
    const { t } = useI18n()

    const animation = ref('fade')

    const table = ref(shared_consts.TABLES_MYSKILLS)

    const idSkill = computed(() => $route.params.idSkill ? $route.params.idSkill.toString() : '')

    const filtroutente = ref(<any[]>[])
    const showPic = ref(false)

    const myskill = ref(<IMySkill>{})

    const username = computed(() => (myskill.value && myskill.value.username) ? myskill.value.username : 'Servizio')

    function profile() {
      return userStore.my.profile
    }

    function myusername() {
      return userStore.my.username
    }

    function checkifShow(col: string) {
      //++Todo: checkifShow Permessi !
      return true
    }


    return {
      profile,
      tools,
      costanti,
      myskill,
      toolsext,
      shared_consts,
      checkifShow,
      globalStore,
      filtroutente,
      showPic,
      myusername,
      userStore,
      t,
      animation,
      fieldsTable,
      colCitys,
      table,
      username,
      idSkill,
    }
  }
})
