pub mod extension;
mod gate;
pub mod policy;
pub mod session_cache;

pub use extension::PermissionExtension;
pub use gate::{Decision, NoOpPermissionGate, PermissionGate, PermissionRequest};
pub use policy::{Policy, PolicyError};
pub use session_cache::SessionCache;

#[cfg(test)]
mod tests {
    use super::*;
    use std::sync::Arc;

    #[tokio::test]
    async fn noop_gate_allows_everything() {
        let gate: Arc<dyn PermissionGate> = Arc::new(NoOpPermissionGate);
        let req = PermissionRequest::new("bash", serde_json::json!({"command": "rm -rf /"}));
        let decision = gate.check(req).await;
        assert!(matches!(decision, Decision::Allowed));
    }
}
