/**
 * Presigned URL Requests Table Component
 */

import React from 'react';
import GenericTable from '../Generic/GenericTable';
import {
  fetch,
  update,
  deleteItem,
  setRefetch,
  deleteItemsByIds,
} from '../../stores/presigned_url_requests/presigned_url_requestsSlice';
import { loadColumns } from './configurePresigned_url_requestsCols';
import type { PresignedUrlRequest } from '../../types/entities';
import type { RootState } from '../../stores/store';
import type { Filter, FilterItem } from '../../types/filters';

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

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

export default TablePresigned_url_requests;
