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

#' Update monte carlo value
#' 
#' Update number_of_repeating in config$exposure database
#' @param scenario data.frame scenario obtained with create_scenario function
#' @param monte_carlo integer number of simulation iterations for Monte Carlo
#' @return scenario_updated
#' 
#' @export
#' @examples
#' scenario_example <- create_scenario(
#'   system.file("input_1culture_2pop.xlsx", package = "ambre")
#' )
#' scenario_updated <- update_monte_carlo(scenario = scenario_example, 
#'                    monte_carlo = 2000)
#' scenario_updated$config[[1]]$exposure
update_monte_carlo <- function(scenario, monte_carlo = 1000) {
  
  new_frequency <- map(.x = scenario$PathID, .f = ~ query_frequency(.x))   # $min et $max

  scenario_updated <- scenario |>
    mutate(
      config = map(
        .x = config,
        .f = ~{
          .x$exposure$value[[1]] <- monte_carlo 
          .x                          
        }
      )
    )
  return(scenario_updated)
    
}
