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

#' Percentage irrigation need
#' 
#' Calculate percentage irrigation need for each culture according to total irrigation need
#' @param scenario data.frame with irrigation_need_m3an column obtained with irrigation_need_calculation function
#' @importFrom dplyr mutate
#' @return (scenario_updated)
#' 
#' @export
#' @examples
#' scenario_apprentissage <- create_scenario(
#'   system.file("input_1culture_2pop.xlsx", package = "ambre")
#' )
#' irrigation_need <- irrigation_need_calculation(scenario_apprentissage)
#'
#' irrigation_pct <- percentage_irrigation_need(irrigation_need)
#' print(irrigation_pct$irrigation_need_percentage)
percentage_irrigation_need <- function(scenario){
  total_irrigation_need <- total_irrigation_need(scenario)
  scenario_updated <- scenario |> mutate("irrigation_need_percentage" = round(irrigation_need_m3an / total_irrigation_need * 100))
  
  return(scenario_updated)
    
}
