declare class ExceLikeTable {
  constructor(container: string | HTMLElement, options?: ExceLikeTableOptions);
  
  setData(data: any[]): void;
  updateData(data: any[]): void;
  getFilters(): Record<string, any>;
  setFilters(filters: Record<string, any>): void;
  clearFilters(): void;
  clearAllFilters(): void;
  setFontSize(size: FontSize): void;
  setCellPadding(padding: CellPadding): void;
  saveSettings(): Promise<boolean>;
  loadSettings(): Promise<boolean>;
  clearSettings(): Promise<boolean>;
  destroy(): void;
}

interface ExceLikeTableOptions {
  data?: any[];
  columns?: ExceLikeTableColumn[];
  preset?: 'simple' | 'standard' | 'advanced' | 'excel';
  features?: Feature[];
  rowKey?: string;
  pagination?: PaginationOptions | false;
  bordered?: boolean;
  size?: 'small' | 'middle' | 'large';
  loading?: boolean;
  tableId?: string;
  persistSettings?: boolean;
  storageAdapter?: TableStorageAdapter;
}

interface PaginationOptions {
  pageSize?: number;
  showSizeChanger?: boolean;
  showTotal?: (total: number, range: [number, number]) => string;
  current?: number;
}

interface ExceLikeTableColumn {
  key: string;
  title: string;
  dataIndex: string;
  width?: number;
  sortable?: boolean;
  filterable?: boolean;
  filterType?: 'text' | 'date-hierarchy' | 'range';
  render?: (value: any, record: any) => string;
  onFilter?: (value: any, record: any) => boolean;
  sorter?: (a: any, b: any) => number;
}

interface TableStorageAdapter {
  save(key: string, settings: any): Promise<boolean>;
  load(key: string): Promise<any>;
  remove(key: string): Promise<boolean>;
  isAvailable(): boolean;
}

declare namespace ColumnHelpers {
  function text(key: string, title: string, options?: any): ExceLikeTableColumn;
  function number(key: string, title: string, options?: any): ExceLikeTableColumn;
  function date(key: string, title: string, options?: any): ExceLikeTableColumn;
  function status(key: string, title: string, statusColors?: Record<string, string>, options?: any): ExceLikeTableColumn;
  function actions(title: string, actions: Array<{key: string, label: string}>, options?: any): ExceLikeTableColumn;
}

type Feature = 'sorting' | 'filtering' | 'pagination' | 'columnSettings' | 'persistSettings' | 'columnResizing' | 'columnPinning';
type FontSize = 'smallest' | 'small' | 'medium' | 'large' | 'largest';
type CellPadding = 'narrow' | 'standard' | 'wide';

export = ExceLikeTable;
export as namespace ExceLikeTable;
export { ColumnHelpers, TableStorageAdapter, ExceLikeTableOptions, ExceLikeTableColumn };