# WARNING - Generated by {fusen} from dev/flat_kwb_infection.Rmd: do not edit by hand # nolint: line_length_linter.

#' Get dose response values
#' 
#' Result from beta Poisson or exponential models
#' 
#' @param dose numeric dose_perEvent values calculate with final_dose_calculation function
#' @param k numeric survival probability
#' @param alpha numeric derived from survival probability
#' @param n50 numeric dose at which 50% of the population is expected to be affected.
#' @param pathogen_name name of the pathogen simulated
#' @references Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0
#'   URL: \url{https://github.com/kwb-r/kwb.utils}
#'   (MIT Licence)
#' @noRd
get_dose_response_values <- function(dose, k, alpha, n50, pathogen_name)
{
  stopifnot(length(k) == 1, length(alpha) == 1, length(n50) == 1)
  
  if (is.na(k) && ! is.na(alpha) && ! is.na(n50)) {
    
    dr.betapoisson(dose = dose, alpha = alpha, N50 = n50)
    
  } else if (! is.na(k) & is.na(alpha) & is.na(n50)) {
    
    dr.expo(dose = dose, k = k)
    
  } else {
    
    stop(sprintf(
      get_stop_text("doseresponse_config_incomplete"), pathogen_name
    ))
  }
}
