import { UserSolution } from "@/interfaces/exam";
export default function ai_usage(solutions: UserSolution[]): number {
    return solutions.reduce((max, solution) => {
        if (solution.type == "writing" && solution && solution.solutions[0] && solution.solutions[0].evaluation && solution.solutions[0].evaluation.ai_detection) {
            const aiUse = solution.solutions[0].evaluation?.ai_detection?.class_probabilities["ai"];
            return aiUse !== undefined ? Math.max(max, aiUse) : max;
        } else {
            return 0;
        }
    }, 0);
}