import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
import actionDoctor from '~/components/pub/my-ui/data/dropdown-action-dd.vue'
import actionNursePhysio from '~/components/pub/my-ui/data/dropdown-action-detail.vue'

const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dd.vue'))

export const config: Config = {
  cols: [{}, {}, {}, {}, {width: 50}, ],

  headers: [
    [
      { label: 'Jenis Vaksin' },
      { label: 'Tanggal Pemberian Vaksin' },
      { label: 'Tanggal Kedaluwarsa Vaksin' },
      { label: 'Dosis Ke' },
      { label: 'Action' },
    ],
  ],

  keys: ['name1', 'date', 'date', 'name2', 'action'],

  delKeyNames: [
    { key: 'code', label: 'Kode' },
    { key: 'name', label: 'Nama' },
  ],

  parses: {
    date: (rec: unknown): unknown => {
      const date = (rec as any).date
      if (typeof date == 'object' && date) {
        return (date as Date).toLocaleDateString('id-ID')
      } else if (typeof date == 'string') {
        return (date as string).substring(0, 10)
      }
      return date
    },
  },

  components: {
    action(rec, idx) {
      return {
        idx,
        rec: rec as object,
        component: action,
      }
    },
  },

  htmls: {

  },
}
