export const calcPayrollFromEmployee = (employee) => {
  const s = employee.salary || {};
  const d = employee.deductions || {};
  const basic = s.basic || 0;
  const housing = s.housing || 0;
  const transport = s.transport || 0;
  const medical = s.medical || 0;
  const bonus = s.bonus || 0;
  const allowances = housing + transport + medical + bonus;
  const grossPay = basic + allowances;
  const tax = d.tax || 0;
  const pension = d.pension || 0;
  const insurance = d.insurance || 0;
  const loan = d.loan || 0;
  const deductions = tax + pension + insurance + loan;
  const netPay = grossPay - deductions;
  return {
    basic,
    allowances,
    grossPay,
    deductions,
    netPay,
    breakdown: { housing, transport, medical, bonus, tax, pension, insurance, loan },
  };
};

export const monthLabel = (month, year) => {
  const names = [
    'January', 'February', 'March', 'April', 'May', 'June',
    'July', 'August', 'September', 'October', 'November', 'December',
  ];
  return `${names[month - 1]} ${year}`;
};
