use axiom_lang::policy::PolicyLoader;
use axiom_lang::verification::Verifier;

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

    let policy = PolicyLoader::load_source(source).unwrap();
    println!("Intents: {:?}", policy.intents.keys().collect::<Vec<_>>());
    
    let intent = policy.get_intent("RunCommand").unwrap();
    println!("Pre conditions count: {}", intent.clauses.pre.len());
    for (i, pre) in intent.clauses.pre.iter().enumerate() {
        println!("  Pre[{}]: {:?}", i, pre);
    }

    let verifier = Verifier::new(policy);
    let v = verifier.verify("RunCommand", &[("command", "rm -rf /")]).unwrap();
    println!("Verdict: allowed={}, reason={:?}", v.allowed(), v.reason());
}
