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

#' Query irrigation need
#' 
#' Retrieve irrigation need according to crop ID 
#' @param scenario data.frame scenario obtained with create_scenario function
#' @importFrom dplyr left_join
#' @return scenario_updated
#' 
#' @export
#' @examples
#' scenario_apprentissage <- create_scenario(
#'   system.file("input_1culture_2pop.xlsx", package = "ambre")
#' )
#'
#' irrigation_need <- query_irrigation_need(scenario_apprentissage)
#' print(irrigation_need$IrrigationNeed)
query_irrigation_need <- function(scenario){
  scenario$CropID <- unlist(scenario$CropID)
  scenario$CropName <- unlist(scenario$CropName)

  scenario_updated <- scenario |>
                      left_join(config_ambre$economic$water_need,
                                by = c("CropID", "CropName"))
  
  return(scenario_updated)
    
}
