import { api } from "@/lib/api-client";
import type { ExamModule } from "@/types";

export interface GenerationParams {
  title: string;
  label?: string;
  entity_id?: number;
  subject_id?: number;
  topic_id?: number;
  difficulty?: string;
  count?: number;
}

export const generationService = {
  async generate(module: ExamModule, params: GenerationParams): Promise<{ exam_id: number; exercises: unknown[] }> {
    return api.post(`/exam/${module}/generate`, params);
  },

  async generateFromScratch(module: ExamModule, params: GenerationParams): Promise<{ exam_id: number; exercises: unknown[] }> {
    return api.post(`/exam/${module}/generate/scratch`, params);
  },
};
