/**
 * Project Memberships Table Component
 */

import React from 'react';
import GenericTable from '../Generic/GenericTable';
import {
  fetch,
  update,
  deleteItem,
  setRefetch,
  deleteItemsByIds,
} from '../../stores/project_memberships/project_membershipsSlice';
import { loadColumns } from './configureProject_membershipsCols';
import type { ProjectMembership } from '../../types/entities';
import type { RootState } from '../../stores/store';
import type { Filter, FilterItem } from '../../types/filters';

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

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

export default TableProject_memberships;
