import type {
  Col,
  KeyLabel,
  RecComponent,
  RecStrFuncComponent,
  RecStrFuncUnknown,
  Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue'

type SmallDetailDto = any

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

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

export const header: Th[][] = [
  [
    { label: 'Nama' },
    { label: "Dosis" },
    { label: 'Satuan' },
    { label: '' },
  ],
]

export const keys = ['name', 'dose', 'uom.name', 'action']

export const delKeyNames: KeyLabel[] = [
  { key: 'code', label: 'Kode' },
  { key: 'name', label: 'Nama' },
]

export const funcParsed: RecStrFuncUnknown = {
  group: (rec: unknown): unknown => {
    return (rec as SmallDetailDto).medicineGroup_code || '-'
  },
}

export const funcComponent: RecStrFuncComponent = {
  action: (rec: unknown, idx: number): RecComponent => {
    const res: RecComponent = {
      idx,
      rec: rec as object,
      component: action,
    }
    return res
  },
}

export const funcHtml: RecStrFuncUnknown = {}
