/**
 * Tour Pages Table Component
 */

import React from 'react';
import GenericTable from '../Generic/GenericTable';
import {
  fetch,
  update,
  deleteItem,
  setRefetch,
  deleteItemsByIds,
} from '../../stores/tour_pages/tour_pagesSlice';
import { loadColumns } from './configureTour_pagesCols';
import type { TourPage } from '../../types/entities';
import type { RootState } from '../../stores/store';
import type { Filter, FilterItem } from '../../types/filters';

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

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

export default TableTour_pages;
