@@[target("rust")]

// Frame type string → C# type spelling.
// Used by framec's C# backend for cast/return-type contexts.
// Part of RFC-0035 round 2: each per-target type mapper is a
// Frame single-state system. The body is native Rust passthrough
// — Frame here functions as a declarative wrapper around a
// match-expression. Showing that Frame can express function-
// definition syntax across many shapes is the point.

@@system CsharpMapType {
    interface:
        map(t: String): String

    machine:
        $Active {
            map(t: String): String {
                let result = match t.as_str() {
                    "Any" => "object".to_string(),
                    "str" | "string" | "String" => "string".to_string(),
                    "int" | "i32" | "i64" | "number" => "int".to_string(),
                    "float" | "f64" | "f32" => "double".to_string(),
                    "bool" | "boolean" => "bool".to_string(),
                    "void" => "void".to_string(),
                    _ => t.clone(),
                };
                @@:(result)
            }
        }
}
