import { h } from 'vue'
import { useModal } from '@/views/Content/hooks/modal'
import { useHisImage } from '../components/HisImages/hooks/hisImage'
const { openDetailsModal } = useModal()

const { showOrHideHisImage } = useHisImage()
export const useBaseDetail = (data: TBaseNode) => {
  function renderDetailsContent() {
    return h(
      'div',
      {},
      Object.keys(data).map(key => h('div', {}, `${key}：${data[key]}`))
    )
  }

  function showDetailsModal() {
    openDetailsModal({
      titleString: 'base详情',
      contentSlot: renderDetailsContent(),
    })
  }

  function showHisImagePreview() {
    showOrHideHisImage(data)
  }

  return { showDetailsModal, showHisImagePreview }
}
