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

#' ID columns to integer
#' 
#' This function does the same thing as kwb.utils::id_columns_to_integer(),
#' but it is bundled with *ambre* to avoid a hard dependency on the
#' unmaintained package.
#' 
#' ID conversion to integer
#' @param data list
#' @return data integer
#' @references
#'   Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0
#'   URL: \url{https://github.com/kwb-r/kwb.utils}
#'   (MIT Licence)
#' @noRd
#' @references 
#'          https://github.com/KWB-R/kwb.qmra/blob/master/R/utils.R 
#' @examples
#' data_test <- data.frame(PathogenID = c(5.5))
#' id_columns_to_integer(data_test)
id_columns_to_integer <- function(data)
{
  # Which ID columns require conversion?
  to_convert <- grepl("ID$", names(data)) & ! sapply(data, is.integer)
  
  data[to_convert] <- lapply(data[to_convert], as.integer)
  
  data
}
