export function calculateBsa(weightKg, heightCm) {
  return Math.sqrt(heightCm * weightKg / 3600);
}

export function calculateWeightBasedDose(weightKg, dosePerKg, frequencyPerDay, maxDoseMg, concentrationMgPerMl) {
  var singleDose = weightKg * dosePerKg;
  var capped = false;
  if (maxDoseMg > 0 && singleDose > maxDoseMg) {
    singleDose = maxDoseMg;
    capped = true;
  }
  var dailyDose = singleDose * frequencyPerDay;
  var volumeMl = concentrationMgPerMl > 0 ? singleDose / concentrationMgPerMl : null;
  return {
    singleDose: singleDose,
    dailyDose: dailyDose,
    volumeMl: volumeMl,
    capped: capped
  };
}
