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

#' Pathogen update
#' 
#' Update the configuration with list of pathogen to be simulated according to pathogen ID
#' @param scenario list obtain from create_scenario()
#' @param pathoName character name of the pathogens simulated
#' @importFrom dplyr mutate if_else
#' @importFrom purrr map
#' @return scenario_updated list scenario updated with the pathogens to be simulated
#' 
#' @export
#' @examples
#' scenario_test <- create_scenario(
#'   system.file("input_1culture_2pop.xlsx", package = "ambre")
#' )
#'
#' scenario_updated <- update_pathogen(scenario = scenario_test,
#'  pathoName = c("Campylobacter jejuni", "Rotavirus"))
update_pathogen <- function(scenario, pathoName){
  pathogen_id <- query_pathogen(pathogenName = pathoName)
  
  scenario_updated <- scenario |> mutate(
    config = map(config, ~ {
        .x$inflow$simulate <- if_else(.x$inflow$PathogenID %in% pathogen_id, 1, .x$inflow$simulate)
        .x 
      }
    )
  )
   
  return(scenario_updated)
}
