import type { ROIInputs, ROIResults } from '@/types/roi'

const EFFICIENCY_GAIN = 0.65

export function calculateROI(inputs: ROIInputs): ROIResults {
  const { hoursPerWeek, hourlyRate } = inputs

  const annualWastedHours = hoursPerWeek * 52
  const annualWastedCost = annualWastedHours * hourlyRate
  const projectedSavings = annualWastedCost * EFFICIENCY_GAIN
  const projectedSavedHours = annualWastedHours * EFFICIENCY_GAIN
  const monthlySavings = projectedSavings / 12

  return {
    annualWastedHours: Math.round(annualWastedHours),
    annualWastedCost: Math.round(annualWastedCost),
    projectedSavings: Math.round(projectedSavings),
    projectedSavedHours: Math.round(projectedSavedHours),
    monthlySavings: Math.round(monthlySavings),
  }
}
