/**
 * A code completion exercise for Social Workers.
 *
 * The function takes in the name (String), age (Int), and marital status (Boolean) of an individual and
 * determines their eligibility for a government assistance program.
 *
 * - If the person is younger than 18 or older than 60, they are not eligible.
 * - If the person is married, they are eligible if their age is between 25 and 50.
 * - If the person is single, they are eligible if their age is between 30 and 45.
 *
 * @return A tuple with three elements:
 *  - The first element indicates eligibility (True or False).
 *  - The second element indicates the reason for eligibility (e.g., "Too young", "Too old", "Eligible", "Ineligible").
 *  - The third element is a map with detailed information about the individual's eligibility.
 */
fun checkEligibility(name: String, age: Int, maritalStatus: Boolean): Triple<Boolean, String, Map<String, Any>> {

    return when {
        age < 18 -> Triple(false, "Too young", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        age > 60 -> Triple(false, "Too old", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        maritalStatus && age in 25..50 -> Triple(true, "Eligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        !maritalStatus && age in 30..45 -> Triple(true, "Eligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        else -> Triple(false, "Ineligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
    }
}
/**
 * A code completion exercise for Social Workers.
 *
 * The function takes in the name (String), age (Int), and marital status (Boolean) of an individual and
 * determines their eligibility for a government assistance program.
 *
 * - If the person is younger than 18 or older than 60, they are not eligible.
 * - If the person is married, they are eligible if their age is between 25 and 50.
 * - If the person is single, they are eligible if their age is between 30 and 45.
 *
 * @return A tuple with three elements:
 *  - The first element indicates eligibility (True or False).
 *  - The second element indicates the reason for eligibility (e.g., "Too young", "Too old", "Eligible", "Ineligible").
 *  - The third element is a map with detailed information about the individual's eligibility.
 */
fun checkEligibility(name: String, age: Int, maritalStatus: Boolean): Triple<Boolean, String, Map<String, Any>> {
/**
 * A code completion exercise for Social Workers.
 *
 * The function takes in the name (String), age (Int), and marital status (Boolean) of an individual and
 * determines their eligibility for a government assistance program.
 *
 * - If the person is younger than 18 or older than 60, they are not eligible.
 * - If the person is married, they are eligible if their age is between 25 and 50.
 * - If the person is single, they are eligible if their age is between 30 and 45.
 *
 * @return A tuple with three elements:
 *  - The first element indicates eligibility (True or False).
 *  - The second element indicates the reason for eligibility (e.g., "Too young", "Too old", "Eligible", "Ineligible").
 *  - The third element is a map with detailed information about the individual's eligibility.
 */
fun checkEligibility(name: String, age: Int, maritalStatus: Boolean): Triple<Boolean, String, Map<String, Any>> {

    return when {
        age < 18 -> Triple(false, "Too young", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        age > 60 -> Triple(false, "Too old", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        maritalStatus && age in 25..50 -> Triple(true, "Eligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        !maritalStatus && age in 30..45 -> Triple(true, "Eligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
        else -> Triple(false, "Ineligible", mapOf("Name" to name, "Age" to age, "Marital Status" to maritalStatus))
    }
}