import type { PropType} from 'vue';
import { computed, defineComponent, ref } from 'vue'

import type { IOperators } from '@model'
import { tools } from '@tools'

export default defineComponent({
  name: 'CCard',
  props: {
    tab: {
      type: String,
      required: true,
      default: 'one',
    },
    op: {
      type: Object as PropType<IOperators>,
      required: true,
    },
  },
  setup(props) {

    const mytab = ref(props.tab)

    function clicca() {
      mytab.value = 'two'
    }

    const myop = computed(() => {
      if (!!props.op) {
        return props.op
      } else {
        return {
          tab: '',
          username: '',
          name: '',
          surname: '',
          qualification: '',
          usertelegram: '',
          disciplines: '',
          certifications: '',
          img: '',
          cell: '',
          email: '',
          paginaweb: '',
          paginafb: '',
          intro: '',
          info: '',
        }
      }
    })

    return {
      mytab,
      myop,
      tools,
      clicca,
    }
  },
})
