import { tools } from '../../store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from 'vue-i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { defineComponent } from 'vue'
import { shared_consts } from '@src/common/shared_vuejs'

export default defineComponent({
  name: 'CCopyBtnSmall',
  props: {
    texttocopy: {
      type: String,
      required: true,
    },
    title: {
      type: String,
      required: false,
      default: '',
    },
    small: {
      type: Boolean,
      required: false,
      default: false,
    }
  },
  components: {},
  setup(props) {
    const $q = useQuasar()
    const { t } = useI18n()

    async function copytoclipandsend() {
      tools.copyStringToClipboard($q, props.texttocopy, true)

      let msg = 'Questo è il link che puoi condividere per farti inviare i RIS:<br><br>👉🏻 ' + props.texttocopy

      tools.sendMsgTelegramCmd($q, t, shared_consts.MsgTeleg.SHARE_TEXT, false, msg)

    }

    function getclass() {
      if (props.small) {
        return 'text-h7'
      } else {
        return 'text-h5'
      }
    }

    return {
      copytoclipandsend,
      tools,
      getclass,
      t,
    }
  },
})
