/**
 * This function updates the status of an event in a dictionary of events.
 *
 * @param event_id The ID of the event.
 * @param events A dictionary containing event details.
 * @return The updated events dictionary.
 */
fun updateEventStatus(eventId: Int, events: MutableMap<Int, MutableMap<String, String>>): MutableMap<Int, MutableMap<String, String>> {

    // Check if the event ID exists in the dictionary
    if (eventId in events) {
        // Get the current status of the event
        val status = events[eventId]?.get("status")
        
        // Use a when statement to update the status based on its current value
        when (status) {
            "upcoming" -> events[eventId]?.set("status", "ongoing")
            "ongoing" -> events[eventId]?.set("status", "completed")
            "completed" -> events[eventId]?.set("status", "archived")
            else -> throw IllegalArgumentException("Invalid event status: $status")
        }
        
        return events
    } else {
        // If the event ID does not exist in the dictionary, raise an exception
        throw IllegalArgumentException("Event ID not found")
    }
}
/**
 * This function updates the status of an event in a dictionary of events.
 *
 * @param event_id The ID of the event.
 * @param events A dictionary containing event details.
 * @return The updated events dictionary.
 */
fun updateEventStatus(eventId: Int, events: MutableMap<Int, MutableMap<String, String>>): MutableMap<Int, MutableMap<String, String>> {
/**
 * This function updates the status of an event in a dictionary of events.
 *
 * @param event_id The ID of the event.
 * @param events A dictionary containing event details.
 * @return The updated events dictionary.
 */
fun updateEventStatus(eventId: Int, events: MutableMap<Int, MutableMap<String, String>>): MutableMap<Int, MutableMap<String, String>> {

    // Check if the event ID exists in the dictionary
    if (eventId in events) {
        // Get the current status of the event
        val status = events[eventId]?.get("status")
        
        // Use a when statement to update the status based on its current value
        when (status) {
            "upcoming" -> events[eventId]?.set("status", "ongoing")
            "ongoing" -> events[eventId]?.set("status", "completed")
            "completed" -> events[eventId]?.set("status", "archived")
            else -> throw IllegalArgumentException("Invalid event status: $status")
        }
        
        return events
    } else {
        // If the event ID does not exist in the dictionary, raise an exception
        throw IllegalArgumentException("Event ID not found")
    }
}