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

#' Inflow concentration
#'
#' To calculate inflow concentration for specified pathogen
#' @param scenario list scenario created with create_scenario
#' @param pathogenName character names of the pathogens to be simulated
#' @param monteCarlo integer number of simulation iterations for Monte Carlo
#' @importFrom purrr map
#' @importFrom dplyr mutate
#' @return scenario_with_concentration
#'
#' @export
#' @examples
#' scenario_test <- create_scenario(system.file("input_1culture_2pop.xlsx", package = "ambre"))
#' result <- inflow_concentration(scenario = scenario_test,
#'  pathogenName = c("Campylobacter jejuni", "Norovirus"),
#'  monteCarlo = 2000)
#'
inflow_concentration <- function(scenario, pathogenName, monteCarlo = 1000){

  scenario_updated_patho <- update_pathogen(scenario = scenario, pathoName = pathogenName)
  scenario_updated_freq <- update_frequency(scenario_updated_patho)
  scenario_updated_vol <- update_volume(scenario_updated_freq)
  scenario_updated_monte_carlo <- update_monte_carlo(scenario = scenario_updated_vol,
                                                     monte_carlo = monteCarlo)

  concentration = map(.x = scenario_updated_monte_carlo$config,
                      .f= ~ simulate_inflow(.x))

  scenario_with_concentration <- scenario_updated_monte_carlo |>
     mutate(inflow_concentration = concentration)
  
  return(scenario_with_concentration)

}
