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

export const evaluationsService = {
  async evaluateWriting(data: { session_id: number; text: string; rubric_id?: number }): Promise<Evaluation> {
    return api.post<Evaluation>("/evaluate/writing", data);
  },

  async evaluateSpeaking(data: { session_id: number; audio_url: string; rubric_id?: number }): Promise<Evaluation> {
    return api.post<Evaluation>("/evaluate/speaking", data);
  },

  async gradeMultiple(data: { session_id: number; answers: { exercise_index: number; answer: string }[] }): Promise<{ results: { exercise_index: number; correct: boolean; score: number }[] }> {
    return api.post("/grading/multiple", data);
  },

  async transcribe(formData: FormData): Promise<{ text: string }> {
    return api.upload<{ text: string }>("/transcribe", formData);
  },
};
