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

export interface SepHistoryData {
  sepNumber: string
  sepDate: string
  referralNumber: string
  diagnosis: string
  serviceType: string
  careClass: string
}

const ActionHistory = defineAsyncComponent(() => import('~/components/app/sep/action-history.vue'))

const keysDefault = ['sepNumber', 'sepDate', 'referralNumber', 'diagnosis', 'serviceType', 'careClass']
const colsDefault = [{ width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }]
const headersDefault = [
  { label: 'NO. SEP' },
  { label: 'TGL. SEP' },
  { label: 'NO. RUJUKAN' },
  { label: 'DIAGNOSIS AWAL' },
  { label: 'JENIS PELAYANAN' },
  { label: 'KELAS RAWAT' },
]

export const config: Config = {
  cols: [...colsDefault],

  headers: [[...headersDefault]],

  keys: [...keysDefault],

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

  parses: {},

  components: {},

  htmls: {},
}

export const configDetail: Config = {
  cols: [...colsDefault, { width: 50 }],

  headers: [[...headersDefault, { label: 'AKSI' }]],

  keys: [...keysDefault, 'action'],

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

  parses: {},

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

  htmls: {},
}
