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

export const examTemplateService = {
  listInternational: () =>
    api.get<ExamTemplate[]>("/exam/templates", { type: "international" }),

  listCustom: () =>
    api.get<ExamTemplate[]>("/exam/templates", { type: "custom" }),

  getById: (id: number) =>
    api.get<ExamTemplate>(`/exam/templates/${id}`),

  saveCustomTemplate: (data: SaveAsTemplateRequest) =>
    api.post<ApiSuccessResponse>("/exam/templates/custom", data),
};
