import { type WorkerData } from "../utils/api";

/**
 * Calculate total kudos/hour across a set of workers.
 * Computes kudos/hour for each worker individually, then sums them.
 */
export const calculateTotalKudosPerHour = (workers: WorkerData[]): number => {
    return workers.reduce((sum, w) => {
        const uptime = w.uptime;
        const generated = w.kudos_details?.generated ?? 0;
        if (uptime <= 0) return sum;
        return sum + (generated / uptime) * 3600;
    }, 0);
};
