import { api } from "@/lib/api-client";
import type { ExamSession, ExamStat, StatisticalData } from "@/types";

export const statsService = {
  async getSessions(params?: Record<string, string | number | boolean | undefined>): Promise<ExamSession[]> {
    return api.get<ExamSession[]>("/sessions", params);
  },

  async getStats(params?: Record<string, string | number | boolean | undefined>): Promise<ExamStat[]> {
    return api.get<ExamStat[]>("/stats", params);
  },

  async getStatistical(params?: { entity_id?: number; start_date?: string; end_date?: string }): Promise<StatisticalData> {
    return api.get<StatisticalData>("/statistical", params as Record<string, string | number | boolean | undefined>);
  },

  async getPerformance(params?: { entity_id?: number; search?: string }): Promise<unknown[]> {
    return api.get<unknown[]>("/stats/performance", params as Record<string, string | number | boolean | undefined>);
  },
};
