/**
 * Calculate the total revenue based on the given sales data.
 *
 * @param salesData A dictionary containing the sales data.
 * @return The total revenue.
 */
fun calculateTotalRevenue(salesData: Map<String, Map<String, Int>>): Double {

    var totalRevenue = 0.0

    for ((_, salesDetails) in salesData) {
        val unitsSold = salesDetails["units_sold"] ?: 0
        val pricePerUnit = salesDetails["price_per_unit"] ?: 0

        // Check if unitsSold is a positive number
        if (unitsSold > 0) {

            // Check if pricePerUnit is a positive number
            if (pricePerUnit > 0) {

                // Calculate the revenue for the product
                val revenue = unitsSold * pricePerUnit

                // Accumulate the revenue to the totalRevenue
                totalRevenue += revenue
            }
        }
    }

    return totalRevenue
}
/**
 * Calculate the total revenue based on the given sales data.
 *
 * @param salesData A dictionary containing the sales data.
 * @return The total revenue.
 */
fun calculateTotalRevenue(salesData: Map<String, Map<String, Int>>): Double {
/**
 * Calculate the total revenue based on the given sales data.
 *
 * @param salesData A dictionary containing the sales data.
 * @return The total revenue.
 */
fun calculateTotalRevenue(salesData: Map<String, Map<String, Int>>): Double {

    var totalRevenue = 0.0

    for ((_, salesDetails) in salesData) {
        val unitsSold = salesDetails["units_sold"] ?: 0
        val pricePerUnit = salesDetails["price_per_unit"] ?: 0

        // Check if unitsSold is a positive number
        if (unitsSold > 0) {

            // Check if pricePerUnit is a positive number
            if (pricePerUnit > 0) {

                // Calculate the revenue for the product
                val revenue = unitsSold * pricePerUnit

                // Accumulate the revenue to the totalRevenue
                totalRevenue += revenue
            }
        }
    }

    return totalRevenue
}