/**
 * This function calculates the total number of clients that have registered their pets with the veterinarian.
 * It iterates through nested loops and counts the clients.
 */
fun calculateTotalClients(vetRecords: List<List<Map<String, Any>>>) : Int {

    var totalClients = 0

    // Iterate over each record of pets
    for (record in vetRecords) {
        // Iterate over each pet in the record
        for (pet in record) {
            // Check if the client is registered
            if (pet["client_registered"] as Boolean) {
                // Increment the total count
                totalClients++
            }
        }
    }

    return totalClients
}

// The vetRecords is a nested list representing different records of pets
val vetRecords = listOf(
    listOf(
        mapOf("name" to "Fluffy", "species" to "cat", "client_registered" to true),
        mapOf("name" to "Buddy", "species" to "dog", "client_registered" to false),
        mapOf("name" to "Snowball", "species" to "rabbit", "client_registered" to true)
    ),
    listOf(
        mapOf("name" to "Max", "species" to "dog", "client_registered" to true),
        mapOf("name" to "Charlie", "species" to "cat", "client_registered" to false),
        mapOf("name" to "Oreo", "species" to "cat", "client_registered" to true)
    )
)
/**
 * This function calculates the total number of clients that have registered their pets with the veterinarian.
 * It iterates through nested loops and counts the clients.
 */
fun calculateTotalClients(vetRecords: List<List<Map<String, Any>>>) : Int {
/**
 * This function calculates the total number of clients that have registered their pets with the veterinarian.
 * It iterates through nested loops and counts the clients.
 */
fun calculateTotalClients(vetRecords: List<List<Map<String, Any>>>) : Int {

    var totalClients = 0

    // Iterate over each record of pets
    for (record in vetRecords) {
        // Iterate over each pet in the record
        for (pet in record) {
            // Check if the client is registered
            if (pet["client_registered"] as Boolean) {
                // Increment the total count
                totalClients++
            }
        }
    }

    return totalClients
}

// The vetRecords is a nested list representing different records of pets
val vetRecords = listOf(
    listOf(
        mapOf("name" to "Fluffy", "species" to "cat", "client_registered" to true),
        mapOf("name" to "Buddy", "species" to "dog", "client_registered" to false),
        mapOf("name" to "Snowball", "species" to "rabbit", "client_registered" to true)
    ),
    listOf(
        mapOf("name" to "Max", "species" to "dog", "client_registered" to true),
        mapOf("name" to "Charlie", "species" to "cat", "client_registered" to false),
        mapOf("name" to "Oreo", "species" to "cat", "client_registered" to true)
    )
)