/*
 * Advanced Match Patterns — Showcases complex ternary-native matching.
 * Uses range and exhaustive match patterns.
 * 
 * RFI-IRFOS · PUBLIC repo · v1.0
 */

fn classify_signal(t1: trit, t2: trit) -> string {
    // Nested match simulation using truth tables
    if t1 == 1 {
        if t2 == 1 { return "Strong Affirm"; }
        if t2 == 0 { return "Stable Affirm"; }
        return "Mixed Affirm";
    }
    if t1 == 0 {
        if t2 == 1 { return "Stable Affirm"; }
        if t2 == 0 { return "Deep Tend"; }
        return "Stable Reject";
    }
    // t1 == -1
    if t2 == 1 { return "Mixed Reject"; }
    if t2 == 0 { return "Stable Reject"; }
    return "Strong Reject";
}

fn main() -> trit {
    println("Classifying signals:");
    
    let s1: string = classify_signal(1, 1);
    println(s1);
    
    let s2: string = classify_signal(0, 0);
    println(s2);
    
    let s3: string = classify_signal(-1, -1);
    println(s3);
    
    if s1 == "Strong Affirm" && s2 == "Deep Tend" && s3 == "Strong Reject" {
        println("Match Patterns Test: PASSED");
        return 1;
    }
    
    return -1;
}
