import React from "react";

type Column = {
  title: string;
  dataIndex: string;
  key: string;
  [key: string]: any;
};

const Columns: React.FC<{
  checkboxProps?: object;
  tableKey: string;
  columnData: Column[];
  isSearchable?: boolean;
  noColumnMessage?: string;
  searchProps?: object;
  buttonProps?: object;
  allowConfigurationResetOnUpdate?: boolean;
  onMutationSuccess?: () => void;
  defaultHiddenColumns?: string[];
  actionBlock?: React.ReactElement;
}>;

function useTableConfigurations(
  tableKey: string,
  columnData: any[],
  onMutationSuccess?: () => void,
  allowConfigurationResetOnUpdate?: boolean,
  defaultHiddenColumns?: string[]
): {
  customizedColumns: Column[];
  allProcessedColumns: Column[];
  existingColumnConfiguration: Column[];
  isTableConfigurationFetching: boolean;
  isTableConfigurationLoading: boolean;
  destroyConfiguration: (tableKey: string) => void;
  hideColumn: (key: string) => void;
  updateColumns: (newOrder: string[]) => void;
  showColumn: (key: string) => void;
};

export default Columns;
