import { defineComponent, onMounted, ref } from 'vue'
import { tools } from '@tools'
import { useUserStore } from '@store/UserStore'
import { useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
import { useGlobalStore } from '@store/globalStore'
import { useProducts } from '@store/Products'
import { useI18n } from 'vue-i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { shared_consts } from '@src/common/shared_vuejs'
// import MixinBase from '@src/mixins/mixin-base'
import { CCatalogoCard } from '@src/components/CCatalogoCard'


export default defineComponent({
  name: 'catalogoInfo',
  components: { CCatalogoCard },
  props: {},
  setup() {
    const userStore = useUserStore()
    const globalStore = useGlobalStore()
    const productStore = useProducts()
    const $router = useRouter()
    const $route = useRoute()
    const $q = useQuasar()
    const { t } = useI18n();
    const id = ref('')
    const cosa = ref(0)

    // const { setValDb, getValDb } = MixinBase()

    function mounted() {
      // Inizializza
      console.log('created productInfo')
      console.log($route)
      if ($route.params.idprod) {
        id.value = $route.params.idprod.toString()
      }
      if ($route.params.idprod) {
        cosa.value = tools.strToVal($route.params.cosa.toString())
      }

    }

    onMounted(mounted)

    return {
      userStore,
      costanti,
      tools,
      toolsext,
      shared_consts,
      id,
      cosa,
    }
  }
})
