import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'

type SmallDetailDto = any

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

export const config: Config = {
  cols: [
    { width: 60 },
    { width: 200 },
    { width: 100 },
    { width: 100 },
    { width: 150 },
    { width: 80 },
    { width: 200 },
    { width: 120 },
  ],

  headers: [
    [
      { label: 'NO.' },
      { label: 'NAMA OBAT' },
      { label: 'DOSIS' },
      { label: 'SATUAN' },
      { label: 'RUTE PEMBERIAN' },
      { label: 'HARI' },
      { label: 'CATATAN' },
      { label: '' },
    ],
  ],

  keys: [
    'number',
    'namaObat',
    'dosis',
    'satuan',
    'rute',
    'hari',
    'catatan',
    'action',
  ],

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

  parses: {
    parent: (rec: unknown): unknown => {
      const recX = rec as SmallDetailDto
      return recX.parent?.name || '-'
    },
  },

  components: {
    action(rec, idx) {
      const res: RecComponent = {
        idx,
        rec: rec as object,
        component: action,
      }
      return res
    },
  },

  htmls: {},
}

