import {
  PaginationState,
  RowSelectionState,
  SortingState,
  ExpandedState,
} from "@tanstack/react-table";
import { Dispatch, SetStateAction } from "react";
import {
  FilterMasterStateProps,
  FilterOperationListProps,
  FilterStateProps,
} from "./filter";
import {
  ColumnTabConfigProps,
  QuickTabConfigProps,
  SavedButtonErrorProps,
  SettingsDataProps,
  SortingConfigProps,
} from "./filter-settings";

export interface CraftTableOptionsProps {
  sorting: SortingState;
  setSorting: Dispatch<SetStateAction<SortingState>>;
  pagination: PaginationState;
  setPagination: Dispatch<SetStateAction<PaginationState>>;
  rowSelection: RowSelectionState;
  setRowSelection: Dispatch<SetStateAction<RowSelectionState>>;
  isCompactTable?: boolean;
  setIsCompactTable?: Dispatch<SetStateAction<boolean>>;
  expanded: ExpandedState;
  setExpanded: Dispatch<SetStateAction<ExpandedState>>;
  wrapColumns: Record<string, boolean>;
  setWrapColumns: Dispatch<SetStateAction<Record<string, boolean>>>;
  filters: FilterStateProps[];
  setFilters: Dispatch<SetStateAction<FilterStateProps[]>>;
  savedFilterEditValue: string | number;
  setSavedFilterEditValue: Dispatch<SetStateAction<string | number>>;
  filterToDelete: FilterOperationListProps | null;
  setFilterToDelete: Dispatch<SetStateAction<FilterOperationListProps | null>>;
  filterSelectedAttributeValue: string;
  setFilterSelectedAttributeValue: Dispatch<SetStateAction<string>>;
  filterMaster: FilterMasterStateProps | null;
  setFilterMaster: Dispatch<SetStateAction<FilterMasterStateProps | null>>;
  showTableFilter: boolean;
  setShowTableFilter: Dispatch<SetStateAction<boolean>>;
  showFilterOptions: boolean;
  setShowFilterOption: Dispatch<SetStateAction<boolean>>;
}

export interface craftTableFilterSettingsOptionsProps {
  settingsData: SettingsDataProps;
  setSettingsData: Dispatch<SetStateAction<SettingsDataProps>>;
  showListViewSettings: boolean;
  setShowListViewSettings: Dispatch<SetStateAction<boolean>>;
  quickTabStates: QuickTabConfigProps;
  setQuickTabStates: Dispatch<SetStateAction<QuickTabConfigProps>>;
  columnTabState: ColumnTabConfigProps;
  setColumnTabState: Dispatch<SetStateAction<ColumnTabConfigProps>>;
  sortingTabState: SortingConfigProps;
  setSortingTabState: Dispatch<SetStateAction<SortingConfigProps>>;
  saveButtonError: SavedButtonErrorProps;
  setSaveButtonError: Dispatch<SetStateAction<SavedButtonErrorProps>>;
}

export interface CraftTableFeatureProps {
  enableSorting?: boolean;
  enableServerSidePagination?: boolean;
  enableServerSideSorting?: boolean;
  enableRowSelection?: boolean;
  enableColumnResizing?: boolean;
  enableColumnReordering?: boolean;
  enableColumnPinning?: boolean;
  enableMultiColumnSorting?: boolean;

  // custom features not provided by react table
  enableTopbar?: boolean;
  enableWordBreakAll?: boolean;
  stickyHeader?: boolean;
  compactTable?: boolean;
  striped?: boolean;
}
