import React from 'react';
import { useStaticListFilterCollection } from '../hooks/useStaticListFilterCollection';
import {
  MultiSelectCheckboxFilter,
  MultiSelectCheckboxFilterProps,
} from '../components/MultiSelectCheckboxFilter';

export type MultiSelectStaticFilterCompatProps<V> = Omit<
  MultiSelectCheckboxFilterProps<V>,
  'collection' | 'data'
> & {
  data: V[];
};

export function MultiSelectCheckboxStaticListFilter<V>(
  props: MultiSelectStaticFilterCompatProps<V>,
) {
  const { filter, data, ...rest } = props;
  const collection = useStaticListFilterCollection(filter, data);
  return (
    <MultiSelectCheckboxFilter
      filter={filter}
      collection={collection}
      {...rest}
    />
  );
}
