/**
 * Page Links Table Component
 */

import React from 'react';
import GenericTable from '../Generic/GenericTable';
import {
  fetch,
  update,
  deleteItem,
  setRefetch,
  deleteItemsByIds,
} from '../../stores/page_links/page_linksSlice';
import { loadColumns } from './configurePage_linksCols';
import type { PageLink } from '../../types/entities';
import type { RootState } from '../../stores/store';
import type { Filter, FilterItem } from '../../types/filters';

interface TablePage_linksProps {
  filterItems: FilterItem[];
  setFilterItems: (items: FilterItem[]) => void;
  filters: Filter[];
  showGrid?: boolean;
}

const TablePage_links: React.FC<TablePage_linksProps> = ({
  filterItems,
  setFilterItems,
  filters,
}) => {
  return (
    <GenericTable<PageLink>
      entityName='page_links'
      sliceSelector={(state: RootState) => state.page_links}
      fetchAction={fetch}
      updateAction={update}
      deleteAction={deleteItem}
      deleteByIdsAction={deleteItemsByIds}
      setRefetchAction={setRefetch}
      loadColumnsFunction={loadColumns}
      filters={filters}
      filterItems={filterItems}
      setFilterItems={setFilterItems}
    />
  );
};

export default TablePage_links;
