/**
 * Function to perform soil analysis based on the given parameters.
 *
 * @param rockType Type of rock present in the soil.
 * @param moistureContent Moisture content in the soil (%).
 * @param isClayey True if the soil is clayey, False otherwise.
 * @return Summary of the soil analysis.
 * @throws IllegalArgumentException If the moisture content is not within the acceptable range.
 */
fun performSoilAnalysis(rockType: String, moistureContent: Float, isClayey: Boolean): String {

    if (rockType !in listOf("granite", "limestone", "schist")) {
        return "Invalid rock type! The available options are 'granite', 'limestone', and 'schist'."
    }

    // nested if-else statements
    return when (rockType) {
        "granite" -> {
            when {
                moistureContent < 10 -> "The soil composition is suitable for constructing foundations."
                moistureContent in 10.0..19.99 -> {
                    if (isClayey) {
                        "The soil composition is suitable for constructing foundations, but extra precautions need to be taken due to clayey nature."
                    } else {
                        "The soil composition is suitable"
                    }
                }
                else -> throw IllegalArgumentException("Moisture content is not within the acceptable range.")
            }
        }
        else -> "" // Handle other rock types if needed
    }
}
/**
 * Function to perform soil analysis based on the given parameters.
 *
 * @param rockType Type of rock present in the soil.
 * @param moistureContent Moisture content in the soil (%).
 * @param isClayey True if the soil is clayey, False otherwise.
 * @return Summary of the soil analysis.
 * @throws IllegalArgumentException If the moisture content is not within the acceptable range.
 */
fun performSoilAnalysis(rockType: String, moistureContent: Float, isClayey: Boolean): String {
/**
 * Function to perform soil analysis based on the given parameters.
 *
 * @param rockType Type of rock present in the soil.
 * @param moistureContent Moisture content in the soil (%).
 * @param isClayey True if the soil is clayey, False otherwise.
 * @return Summary of the soil analysis.
 * @throws IllegalArgumentException If the moisture content is not within the acceptable range.
 */
fun performSoilAnalysis(rockType: String, moistureContent: Float, isClayey: Boolean): String {

    if (rockType !in listOf("granite", "limestone", "schist")) {
        return "Invalid rock type! The available options are 'granite', 'limestone', and 'schist'."
    }

    // nested if-else statements
    return when (rockType) {
        "granite" -> {
            when {
                moistureContent < 10 -> "The soil composition is suitable for constructing foundations."
                moistureContent in 10.0..19.99 -> {
                    if (isClayey) {
                        "The soil composition is suitable for constructing foundations, but extra precautions need to be taken due to clayey nature."
                    } else {
                        "The soil composition is suitable"
                    }
                }
                else -> throw IllegalArgumentException("Moisture content is not within the acceptable range.")
            }
        }
        else -> "" // Handle other rock types if needed
    }
}