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

#' Total irrigation need
#' 
#' Calculate total irrigation need according to irrigation need of each culture of the simulated scenario
#' @param scenario data.frame scenario with irrigation_need_m3an column obtained with irrigation_need_calculation function
#' @importFrom dplyr distinct select
#' @return total_irrigation_need
#' 
#' @export
#' @examples
#' scenario_apprentissage <- create_scenario(
#'   system.file("input_1culture_2pop.xlsx", package = "ambre")
#' )
#' irrigation_need <- irrigation_need_calculation(scenario_apprentissage)
#' total_irrigation_need(irrigation_need)
total_irrigation_need <- function(scenario){
  
  total_irrigation_need_df <- scenario |> select(CropID, irrigation_need_m3an) |>  distinct()
  total_irrigation_need <- sum(total_irrigation_need_df$irrigation_need_m3an)
  return(total_irrigation_need)
}
