/**
 * This function retrieves the nurse notes recorded between the given start and end date.
 * It returns a list of nurse notes for the specified date range.
 *
 * @param notes A list of nurse notes as strings.
 * @param start_date The start date of the required date range.
 * @param end_date The end date of the required date range.
 * @return A list of nurse notes between the start and end date (inclusive).
 * @throws IllegalArgumentException If the start_date is after the end_date.
 * @throws IndexOutOfBoundsException If any of the index values are out of range.
 */
fun getNurseNotes(notes: List<String>, startDate: String, endDate: String): List<String> {

    try {
        if (startDate > endDate) {
            throw IllegalArgumentException("Start date cannot be after the end date")
        } else {
            val startIndex = notes.indexOf(startDate)
            val endIndex = notes.indexOf(endDate)

            // Fetch nurse notes for the specified range using slicing
            val nurseNotes = notes.subList(startIndex, endIndex + 1)

            return nurseNotes
        }
    } catch (e: IllegalArgumentException) {
        println(e.message)
    } catch (e: IndexOutOfBoundsException) {
        println(e.message)
    }

    return emptyList()
}
/**
 * This function retrieves the nurse notes recorded between the given start and end date.
 * It returns a list of nurse notes for the specified date range.
 *
 * @param notes A list of nurse notes as strings.
 * @param start_date The start date of the required date range.
 * @param end_date The end date of the required date range.
 * @return A list of nurse notes between the start and end date (inclusive).
 * @throws IllegalArgumentException If the start_date is after the end_date.
 * @throws IndexOutOfBoundsException If any of the index values are out of range.
 */
fun getNurseNotes(notes: List<String>, startDate: String, endDate: String): List<String> {
/**
 * This function retrieves the nurse notes recorded between the given start and end date.
 * It returns a list of nurse notes for the specified date range.
 *
 * @param notes A list of nurse notes as strings.
 * @param start_date The start date of the required date range.
 * @param end_date The end date of the required date range.
 * @return A list of nurse notes between the start and end date (inclusive).
 * @throws IllegalArgumentException If the start_date is after the end_date.
 * @throws IndexOutOfBoundsException If any of the index values are out of range.
 */
fun getNurseNotes(notes: List<String>, startDate: String, endDate: String): List<String> {

    try {
        if (startDate > endDate) {
            throw IllegalArgumentException("Start date cannot be after the end date")
        } else {
            val startIndex = notes.indexOf(startDate)
            val endIndex = notes.indexOf(endDate)

            // Fetch nurse notes for the specified range using slicing
            val nurseNotes = notes.subList(startIndex, endIndex + 1)

            return nurseNotes
        }
    } catch (e: IllegalArgumentException) {
        println(e.message)
    } catch (e: IndexOutOfBoundsException) {
        println(e.message)
    }

    return emptyList()
}