/**
 * Assign shifts to nurses based on their availability.
 *
 * @param nursingStaff A list containing the names of the nurses.
 * @param shiftSchedule A 2D list representing the availability of each nurse for each shift,
 *                      where '1' indicates availability and '0' indicates unavailability.
 * @return A list containing the assigned shifts for each nurse, considering their availability.
 */
import kotlin.random.Random


fun nurseShiftSchedule(nursingStaff: List<String>, shiftSchedule: List<List<Int>>): List<Pair<String, String>> {

    val schedule = mutableListOf<Pair<String, String>>()
    val mutableShiftSchedule = shiftSchedule.toMutableList()

    for (nurse in nursingStaff) {
        val shift = mutableShiftSchedule.random()
        when {
            shift[0] == 1 -> schedule.add(nurse to "Morning Shift")
            shift[1] == 1 -> schedule.add(nurse to "Afternoon Shift")
            shift[2] == 1 -> schedule.add(nurse to "Night Shift")
            else -> schedule.add(nurse to "No Availability")
        }
        mutableShiftSchedule.remove(shift)
    }

    return schedule
}
import kotlin.random.Random

/**
 * Assign shifts to nurses based on their availability.
 *
 * @param nursingStaff A list containing the names of the nurses.
 * @param shiftSchedule A 2D list representing the availability of each nurse for each shift,
 *                      where '1' indicates availability and '0' indicates unavailability.
 * @return A list containing the assigned shifts for each nurse, considering their availability.
 */
fun nurseShiftSchedule(nursingStaff: List<String>, shiftSchedule: List<List<Int>>): List<Pair<String, String>> {
import kotlin.random.Random

/**
 * Assign shifts to nurses based on their availability.
 *
 * @param nursingStaff A list containing the names of the nurses.
 * @param shiftSchedule A 2D list representing the availability of each nurse for each shift,
 *                      where '1' indicates availability and '0' indicates unavailability.
 * @return A list containing the assigned shifts for each nurse, considering their availability.
 */
fun nurseShiftSchedule(nursingStaff: List<String>, shiftSchedule: List<List<Int>>): List<Pair<String, String>> {

    val schedule = mutableListOf<Pair<String, String>>()
    val mutableShiftSchedule = shiftSchedule.toMutableList()

    for (nurse in nursingStaff) {
        val shift = mutableShiftSchedule.random()
        when {
            shift[0] == 1 -> schedule.add(nurse to "Morning Shift")
            shift[1] == 1 -> schedule.add(nurse to "Afternoon Shift")
            shift[2] == 1 -> schedule.add(nurse to "Night Shift")
            else -> schedule.add(nurse to "No Availability")
        }
        mutableShiftSchedule.remove(shift)
    }

    return schedule
}