import { usePagination } from "hooks/usePagination";
import { services } from "services";

export function useSegmentsList(searchTerm: string) {
  return usePagination(
    "segments",
    async (queryParams) => {
      return await services.segment().getSegmentsWithCursor(
        queryParams,
        searchTerm
      );
    },
    async (countParams) => {
      return await services.segment().getSegmentsCount(
        countParams,
        searchTerm,
      );
    },
    10,
    "DESC",
    [searchTerm]
  );
}
