/**
 * Given a list of firefighters, their IDs and a new status, this function changes the status
 * of a particular firefighter based on the provided ID.
 *
 * @param firefighterList A list of maps representing firefighters. Each map
 * contains 'id' and 'status' keys to store the ID and current status
 * of a firefighter.
 * @param firefighterId The ID of the firefighter whose status needs to be updated.
 * @param newStatus The new status to assign to the firefighter.
 * @return True if the firefighter status was successfully changed; False otherwise.
 */
fun changeFirefighterStatus(firefighterList: MutableList<MutableMap<String, Any>>, firefighterId: Int, newStatus: String): Boolean {

    for (firefighter in firefighterList) {
        if (firefighter["id"] == firefighterId) {
            firefighter["status"] = newStatus
            return true
        }
    }
    return false
}

// Example usage
val firefighters = mutableListOf(
    mutableMapOf("id" to 1, "status" to "active"),
    mutableMapOf("id" to 2, "status" to "inactive"),
    mutableMapOf("id" to 3, "status" to "active"),
    mutableMapOf("id" to 4, "status" to "inactive"),
    mutableMapOf("id" to 5, "status" to "active")
)
/**
 * Given a list of firefighters, their IDs and a new status, this function changes the status
 * of a particular firefighter based on the provided ID.
 *
 * @param firefighterList A list of maps representing firefighters. Each map
 * contains 'id' and 'status' keys to store the ID and current status
 * of a firefighter.
 * @param firefighterId The ID of the firefighter whose status needs to be updated.
 * @param newStatus The new status to assign to the firefighter.
 * @return True if the firefighter status was successfully changed; False otherwise.
 */
fun changeFirefighterStatus(firefighterList: MutableList<MutableMap<String, Any>>, firefighterId: Int, newStatus: String): Boolean {
/**
 * Given a list of firefighters, their IDs and a new status, this function changes the status
 * of a particular firefighter based on the provided ID.
 *
 * @param firefighterList A list of maps representing firefighters. Each map
 * contains 'id' and 'status' keys to store the ID and current status
 * of a firefighter.
 * @param firefighterId The ID of the firefighter whose status needs to be updated.
 * @param newStatus The new status to assign to the firefighter.
 * @return True if the firefighter status was successfully changed; False otherwise.
 */
fun changeFirefighterStatus(firefighterList: MutableList<MutableMap<String, Any>>, firefighterId: Int, newStatus: String): Boolean {

    for (firefighter in firefighterList) {
        if (firefighter["id"] == firefighterId) {
            firefighter["status"] = newStatus
            return true
        }
    }
    return false
}

// Example usage
val firefighters = mutableListOf(
    mutableMapOf("id" to 1, "status" to "active"),
    mutableMapOf("id" to 2, "status" to "inactive"),
    mutableMapOf("id" to 3, "status" to "active"),
    mutableMapOf("id" to 4, "status" to "inactive"),
    mutableMapOf("id" to 5, "status" to "active")
)