export type ComponentType = Component

export interface Col {
  span?: number
  classVal?: string
  style?: string
  width?: number // specific for width
  widthUnit?: string // specific for width
}

export interface Th {
  label: string
  colSpan?: number
  rowSpan?: number
  classVal?: string
  childClassVal?: string
  style?: string
  childStyle?: string
  hideOnSm?: boolean
}

export interface KeyLabel {
  key: string
  label: string
}

export interface RecComponent {
  idx?: number
  rec: object
  props?: any
  component: ComponentType
}

export type FuncRecUnknown = (rec: unknown, idx: number) => unknown
export type FuncComponent = (rec: unknown, idx: number) => RecComponent
export type RecStrFuncUnknown = Record<string, FuncRecUnknown>
export type RecStrFuncComponent = Record<string, FuncComponent>

export interface KeyNames {
  key: string
  label: string
}

export type Config = {
  headers?: Th[][]
  cols: Col[]
  keys: string[]
  delKeyNames?: KeyLabel[]
  parses?: RecStrFuncUnknown
  components?: RecStrFuncComponent
  htmls?: RecStrFuncUnknown
  skeletonSize?: number
  selectMode?: 'single' | 'multiple'
  modelValue?: any[] | any
}

export interface DataTableLoader {
  isTableLoading: boolean
  [key: string]: boolean
}
