import { api } from "@/lib/api-client";
import type { CustomExamCreateRequest, CustomExamConfig } from "@/types";
import type { ApiSuccessResponse } from "@/types";

export const customExamService = {
  create: (data: CustomExamCreateRequest) =>
    api.post<{ exam_id: number }>("/exam/custom/create", data),

  getById: (examId: number) =>
    api.get<CustomExamConfig>(`/exam/custom/${examId}`),

  update: (examId: number, data: Partial<CustomExamConfig>) =>
    api.put<ApiSuccessResponse>(`/exam/custom/${examId}`, data),

  delete: (examId: number) =>
    api.delete<ApiSuccessResponse>(`/exam/custom/${examId}`),
};
