import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { ListResult, RecordModel } from 'pocketbase';

import { pb } from '@/lib/pb';

interface ListWithOptionParams {
  currentPage: number;
  rowsPerPage: number;
  listOption?: {
    filter?: string;
    sort?: string;
    expand?: string;
  };
}

export default function listWithOption({
  currentPage,
  rowsPerPage,
  listOption = {},
}: ListWithOptionParams): Promise<ListResult<RecordModel>> {
  return pb.collection(COL_QUIZ_LP_CATEGORIES).getList(currentPage + 1, rowsPerPage, listOption);
}
