/**
 * This function retrieves the water quality values from a given location in a dictionary.
 *
 * @param location The location to retrieve the data.
 * @param data A dictionary contains the water quality values for different locations.
 * @return A tuple containing the respective values for parameters such as pH, temperature, and turbidity.
 */
fun getWaterQuality(location: String, data: Map<String, Map<String, Double>>): Triple<Double, Double, Double>? {

    if (location in data) {
        val waterQuality = data[location]

        // Accessing pH value
        val phValue = waterQuality?.get("pH") ?: 0.0

        // Accessing temperature value
        val temperatureValue = waterQuality?.get("temperature") ?: 0.0

        // Accessing turbidity value
        val turbidityValue = waterQuality?.get("turbidity") ?: 0.0

        return Triple(phValue, temperatureValue, turbidityValue)
    } else {
        println("Location not found in the given data.")
        return null
    }
}

// Example data dictionary
val waterQualityData = mapOf(
    "River A" to mapOf("pH" to 7.2, "temperature" to 18.5, "turbidity" to 2.3),
    "Lake B" to mapOf("pH" to 6.8, "temperature" to 22.7, "turbidity" to 5.1)
)
/**
 * This function retrieves the water quality values from a given location in a dictionary.
 *
 * @param location The location to retrieve the data.
 * @param data A dictionary contains the water quality values for different locations.
 * @return A tuple containing the respective values for parameters such as pH, temperature, and turbidity.
 */
fun getWaterQuality(location: String, data: Map<String, Map<String, Double>>): Triple<Double, Double, Double>? {
/**
 * This function retrieves the water quality values from a given location in a dictionary.
 *
 * @param location The location to retrieve the data.
 * @param data A dictionary contains the water quality values for different locations.
 * @return A tuple containing the respective values for parameters such as pH, temperature, and turbidity.
 */
fun getWaterQuality(location: String, data: Map<String, Map<String, Double>>): Triple<Double, Double, Double>? {

    if (location in data) {
        val waterQuality = data[location]

        // Accessing pH value
        val phValue = waterQuality?.get("pH") ?: 0.0

        // Accessing temperature value
        val temperatureValue = waterQuality?.get("temperature") ?: 0.0

        // Accessing turbidity value
        val turbidityValue = waterQuality?.get("turbidity") ?: 0.0

        return Triple(phValue, temperatureValue, turbidityValue)
    } else {
        println("Location not found in the given data.")
        return null
    }
}

// Example data dictionary
val waterQualityData = mapOf(
    "River A" to mapOf("pH" to 7.2, "temperature" to 18.5, "turbidity" to 2.3),
    "Lake B" to mapOf("pH" to 6.8, "temperature" to 22.7, "turbidity" to 5.1)
)