use axiom_lang::AxiomEngine;

fn main() {
    let source = r#"
        module test {
            intent RunCommand {
                takes: command: String;
                gives: output: String;
                effect: NOOP;
                pre: !contains(command, "rm -rf /");
                pre: !contains(command, "dd if=/dev/zero");
                pre: !starts_with(command, "shutdown");
            }
        }
    "#;

    let engine = AxiomEngine::from_source(source).unwrap();
    
    println!("Testing 'rm -rf /'...");
    let verdict = engine.verify("RunCommand", &[("command", "rm -rf /")]).unwrap();
    println!("Verdict: allowed={}, reason={:?}", verdict.allowed(), verdict.reason());
    
    println!("\nTesting 'dd if=/dev/zero'...");
    let verdict = engine.verify("RunCommand", &[("command", "dd if=/dev/zero")]).unwrap();
    println!("Verdict: allowed={}, reason={:?}", verdict.allowed(), verdict.reason());
    
    println!("\nTesting 'shutdown -h now'...");
    let verdict = engine.verify("RunCommand", &[("command", "shutdown -h now")]).unwrap();
    println!("Verdict: allowed={}, reason={:?}", verdict.allowed(), verdict.reason());
    
    println!("\nTesting 'ls -la'...");
    let verdict = engine.verify("RunCommand", &[("command", "ls -la")]).unwrap();
    println!("Verdict: allowed={}, reason={:?}", verdict.allowed(), verdict.reason());
}
