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

#' Path Query
#' 
#' Query to return path ID from path Name using the database
#' @param config list configuration file default value is config_ambre dataset
#' @param pathName character Name of the path for which you want to find the ID
#' @importFrom dplyr filter pull
#' @return pathID integer ID of the population define
#' 
#' @export
#' @examples
#' query_exp_path(pathName = "Consumption of the final product potatoes")
query_exp_path <- function(config = config_ambre, pathName){
  allowed_path <- c("Ingestion of water droplets during maintenance of the irrigation system",
                      "Ingestion of water droplets during a power outage",
                      "Inhalation of aerosols while moving through fields during irrigation",
                      "Ingestion following direct contact with a part of the plant during crop maintenance, followed by hand-to-mouth contact",
                      "Ingestion following direct contact with the soil during crop maintenance, followed by hand-to-mouth contact",
                      "Ingestion following direct contact with a part of the plant during harvesting, followed by hand-to-mouth contact",
                      "Ingestion following direct contact with the ground during harvesting, followed by hand-to-mouth contact",
                      "Ingestion of water droplets during irrigation near residential areas",
                      "Inhalation of aerosols during irrigation near residential areas",
                      "Ingestion of water droplets while moving near irrigated areas",
                      "Inhalation of aerosols while driving near irrigated areas",
                      "Consumption of the final product potatoes",
                      "Consumption of the final product onion",
                      "Consumption of the final product apple",
                      "Consumption of the final product salad",
                      "Consumption of the final product tomato",
                      "Consumption of the final product surface and leafy (e.g., salad)",
                      "Consumption of the final product surface, not leaf (e.g., tomato)",
                      "Consumption of the final product through the soil roots")
  if (any(!pathName %in% allowed_path)) {
    stop("Path name doesn't exist")}
  
  pathID <- config_ambre$path$description |> filter(PathDescription %in% pathName) |> 
                                          pull(PathID)
  matrixID <- config_ambre$path$description |> filter(PathDescription %in% pathName) |> 
                                          pull(MatrixID)
  result <- list(PathID = pathID, MatrixID = matrixID)
  return(pathID)

}
