import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from 'vue-i18n'
import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { tools } from '@tools'
import { costanti } from '@costanti'
import { shared_consts } from '@src/common/shared_vuejs'
import { CMyFieldDb } from '@src/components/CMyFieldDb'
import { CDateTime } from '@src/components/CDateTime'
import { toolsext } from '@src/store/Modules/toolsext'
import { computed } from 'vue'

export default defineComponent({
  name: 'CNotifSettings',
  props: {
  },
  components: { CMyFieldDb },
  setup(props, { emit }) {
    const $q = useQuasar()
    const { t } = useI18n()
    const globalStore = useGlobalStore()
    const userStore = useUserStore()

    const profile = computed(() => userStore.my.profile)


    function mounted() {
      //
    }

    function getnotifbydir(dir: string) {
      const myrec = profile.value.notifs.find((rec: any) => rec.dir === dir)
      if (myrec) {
        return myrec.value
      }
    }

    onMounted(mounted)

    return {
      t,
      tools,
      costanti,
      shared_consts,
      fieldsTable,
      globalStore,
      toolsext,
      profile,
      getnotifbydir,
    }
  },
})

