import { useLocation, useParams } from "react-router-dom";
import React from "react";
import { useGetAllCycle } from "../../../api/cycle";
import DataTable from "../../../Layout/Dashboard/Table/DataTable";
import { useColumns } from "./useTableColumns";
import useSearchQuery from "../../../api/utils/useSearchQuery";
import { ParamsEnum } from "../../../enums/params";

const App: React.FC = () => {
  const [searchQuery] = useSearchQuery("name");
  const { branch_id } = useParams<ParamsEnum>();
  const response = useGetAllCycle({
    name: searchQuery,
    pagination: true,
    branch_id: branch_id,
  });

  return <DataTable response={response} useColumns={useColumns} />;
};

export default App;
