import { ExamType } from "@/_types/Types";
import { apiFetch } from "@/_lib/api/api";

interface ExamResponse {
  data: { data: ExamType[]; current_page: number; last_page: number };
  message: string;
  status: string;
}

export const getExams = async (
  page: number = 1,
  perPage: number = 20
): Promise<ExamResponse> => {
  return apiFetch(`/api/exams?page=${page}&per_page=${perPage}`);
};

export const getExam = async (slug: string | number) => {
  return apiFetch(`/api/exams/${slug}`);
};
