/**
 * Asset Variants Table Component
 */

import React from 'react';
import GenericTable from '../Generic/GenericTable';
import {
  fetch,
  update,
  deleteItem,
  setRefetch,
  deleteItemsByIds,
} from '../../stores/asset_variants/asset_variantsSlice';
import { loadColumns } from './configureAsset_variantsCols';
import type { AssetVariant } from '../../types/entities';
import type { RootState } from '../../stores/store';
import type { Filter, FilterItem } from '../../types/filters';

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

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

export default TableAsset_variants;
