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

#' Simulate: exposure
#' 
#' This function does the same thing as kwb.qmra::get_treatment_data(),
#' but it is bundled with *ambre* to avoid a hard dependency on the 
#' unmaintained package.
#' 
#' @param config as retrieved by config_read() 
#' @param debug print debug information (default: TRUE)
#' @return list with parameters of user defined exposure scenario (number of events 
#' and volumes per Event)
#' @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)
#' @export
#' @examples
#' \donttest{
#' scenario_test <- create_scenario(system.file("input_1culture_2pop.xlsx", package = "ambre"))
#' scenario_updated <- update_pathogen(scenario = scenario_test,
#'  pathoName = c("Campylobacter jejuni", "Rotavirus"))
#'
#' simulate_exposure(config = scenario_updated$config[[1]])
#'}
simulate_exposure <- function(config, debug = TRUE){
  catIf(debug, sprintf("Simulated exposure: volume per event\n"))

  n_events <- number_of_exposures(config)
  
  volumes <-  generate_random_values(
    config = config$exposure[config$exposure$name == "volume_perEvent", ], 
    number_of_repeatings = number_of_repeatings(config),
    number_of_events = n_events,
    debug = debug
  )
  
  list(
    #number_of_events = n_events,
    volumes = list(
      events = renameColumns(volumes$events, list(
        values = "volume_perEvent"
      ))
    )
  )
}
