import { apiRequest } from "@/lib/api/api-service";
import { ApiResponse } from "@/types/api-response";
import type {
  AnalyzeMatchesDto,
  AnalysisResultDto,
  AnalysisHistoryDto,
} from "./types";

/**
 * Analysis Service
 * Backend: /api/analysis/*
 */

const analyzeMatches = (dto: AnalyzeMatchesDto) => {
  return apiRequest<ApiResponse<AnalysisResultDto>>({
    url: "/analysis/analyze",
    client: "core",
    method: "post",
    data: dto,
  });
};

const getHistory = () => {
  return apiRequest<ApiResponse<AnalysisHistoryDto>>({
    url: "/analysis/history",
    client: "core",
    method: "get",
  });
};

export const analysisService = {
  analyzeMatches,
  getHistory,
};
