import React from "react";
import DataTable from "../../../Layout/Dashboard/Table/DataTable";
import { useColumns } from "./useTableColumns";
import useSearchQuery from "../../../api/utils/useSearchQuery";
import { useFilterState } from "../../../Components/Utils/Filter/FilterState";
import { useGetAllCollections } from "../../../api/collections";
import { useFilterStateState } from "../../../zustand/Filter";

const App: React.FC = () => {
  const { filterState } = useFilterState();
  const { Filter } = useFilterStateState();
  const name = Filter?.description;
  const sort_by = Filter?.sort_by;

  const response = useGetAllCollections({
    pagination: true,
    ...filterState,
    name,
    sort_by,
  });
  return <DataTable response={response} useColumns={useColumns} />;
};

export default App;
