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

#' Population Query
#' 
#' Query to return population ID from population Name using the database
#' @param config list configuration file default value is config_ambre dataset
#' @param popName character Name of the population for which you want to find the ID
#' @importFrom dplyr filter pull
#' @return popID integer ID of the population define
#' 
#' @export
#' @examples
#' query_pop(popName = "Irrigation staff")
query_pop <- function(config = config_ambre, popName){
  allowed_pop <- c("Irrigation staff", "Maintenance staff", "Harvesting staff", "Local residents", "Passerby", "Consumers")
  if (any(!popName %in% allowed_pop)) {
    stop("Population name doesn't exist")}
  
  popID <- config_ambre$path$description |> filter(PopulationName %in% popName) |> 
                                          pull(PopulationID) |> unique()
  return(popID)
    
}
