import { tools } from '../../store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { defineComponent, PropType, ref } from 'vue'
import { IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { CLabel } from '@/components/CLabel'
import { CSendCoins } from '@/components/CSendCoins'

export default defineComponent({
  name: 'CContactUser',
  props: {
    myuser: {
      type: Object as PropType<IUserFields>,
      required: true,
    },
    showBtnActivities: {
      type: Boolean,
      required: true,
    }
  },
  components: { CLabel, CSendCoins },
  setup(props) {
    const $q = useQuasar()
    const userStore = useUserStore()
    const globalStore = useGlobalStore()

    const showsendCoinTo = ref(false)
    const showingtooltip = ref(false)

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

    function getLinkUserTelegram() {

      if (props.myuser) {
        if (!!props.myuser.profile.username_telegram) {
          return 'https://t.me/' + props.myuser.profile.username_telegram
        }
      } else {
        return ''
      }
    }

    function getLinkWebSite() {
      if (props.myuser) {
        let mysite = props.myuser.profile.website!
        if (mysite) {
          if (!mysite.startsWith('http')) {
            mysite = 'https://' + mysite
          }
        }
        return mysite
      } else {
        return ''
      }
    }

    return {
      tools,
      userStore,
      shared_consts,
      showsendCoinTo,
      getLinkUserTelegram,
      getLinkWebSite,
      myusername,
      showingtooltip,
    }
  },
})
