import type { LocaleMessage } from 'vue-i18n';

export interface TableColumnOptions {
  targetBlank: boolean;
}

export interface TableColumn<T = unknown> {
  name: string;
  required?: boolean;
  label?: string | LocaleMessage;
  align?: 'left' | 'right' | 'center';
  formatField?: string;
  defaultFormatField?: string;
  field?: ((row: T) => string | T) | string;
  format?: (row: T | string) => string;
  sortable?: boolean;
  handler?: (row: T, options: TableColumnOptions) => void;
  style?: string;
  isHTML?: boolean;
  icon?: string;
  handlerField?: string;
  isDisable?: boolean;
}

export interface RTableColumn<T = unknown, O = unknown> {
  name: string;
  required?: boolean;
  label?: string | LocaleMessage;
  sortByLabel?: string | LocaleMessage;
  fullLabel?: string | LocaleMessage;
  sortBy?: string;
  align?: 'left' | 'right' | 'center' | 'stretch';
  valign?: 'left' | 'right' | 'center' | 'stretch';
  width?: string;
  type?: 'action' | 'regular' | 'bold' | 'date' | 'gray-numbrts' | 'address';
  classes?: string;
  borderless?: boolean;
  collaps?: boolean;
  componentPath?: string;
  componentOptions?: O;
  formatField?: string;
  defaultFormatField?: string;
  field?: ((row: T) => string | string[] | T) | string | string[];
  format?: (row: T | string) => string;
  sortable?: boolean;
  handler?: (row: T, options: TableColumnOptions) => void;
  style?: string;
  isHTML?: boolean;
  icon?: string;
  handlerField?: string;
  isDisable?: boolean;
  fields?: RTableColumn<T>[];
  headerClasses?: string;
  headerStyle?: string;
}

export interface RTableSort {
  label: string | LocaleMessage;
  field: string;
}
