#' Import and validate RTT data
#'
#' @param path Optional path to an NHS Referral-to-Treatment (RTT) CSV file.
#' If NULL, the example data included in the package is loaded.
#'
#' @return A cleaned data frame.
#' @importFrom utils read.csv
#'
#' @examples
#' sample_path <- system.file(
#'   "extdata",
#'   "rtt_trust_month_panel_last24_FIXED-2.csv",
#'   package = "VOWR"
#' )
#'
#' data <- vowr_import(sample_path)
#' head(data)
#'
#' @export
vowr_import <- function(path = NULL) {

  if (is.null(path)) {
    path <- system.file(
      "extdata",
      "rtt_trust_month_panel_last24_FIXED-2.csv",
      package = "VOWR"
    )
  }

  if (path == "") {
    stop("File not found. Please check the file path or inst/extdata folder.")
  }

  data <- utils::read.csv(path, stringsAsFactors = FALSE)

  return(data)
}
