import type { Config } from '~/components/pub/my-ui/data-table'
import type { Patient } from '~/models/patient'
import { defineAsyncComponent } from 'vue'
import { educationCodes, genderCodes } from '~/lib/constants'
import { calculateAge } from '~/lib/utils'

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

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

  headers: [
    [
      { label: 'Tgl Laporan' },
      { label: 'DPJP Bedah' },
      { label: 'DPJP Anastesi' },
      { label: 'Tgl Pembedahan' },
      { label: 'Jenis Operasi' },
      { label: 'Kode Billing' },
      { label: 'Sistem Operasi' },
      { label: 'Action' },
    ],
  ],

  keys: ['date', 'doctor.employee.person.name', 'doctor.employee.person.name', 'date', 'name', 'name', 'name', '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: {

  },
}
