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: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 120 },
    { width: 50 },
  ],

  headers: [
    [
      { label: 'TANGGAL' },
      { label: 'NO. RM' },
      { label: 'NO. BILL' },
      { label: 'JK' },
      { label: 'ALAMAT' },
      { label: 'KLINIK ASAL' },
      { label: 'NAMA DOKTER' },
      { label: 'CARA BAYAR' },
      { label: 'RUJUKAN' },
      { label: 'KET. RUJUKAN' },
      { label: 'ASAL' },
      { label: '' },
    ],
  ],

  keys: [
    'tanggal',
    'noRm',
    'noBill',
    'jk',
    'alamat',
    'klinik',
    'dokter',
    'caraBayar',
    'rujukan',
    'ketRujukan',
    'asal',
    '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: {},
}
