//! Rhai wrappers for Virt module functions
//!
//! This module provides Rhai wrappers for the functions in the Virt module,
//! including Buildah, Nerdctl, and RFS functionality.

use rhai::{Engine, EvalAltResult};

pub mod buildah;
pub mod btrfs;
pub mod nerdctl;
pub mod rfs;
pub mod qcow2;
pub mod cloudhv;

/// Register all Virt module functions with the Rhai engine
///
/// # Arguments
///
/// * `engine` - The Rhai engine to register the functions with
///
/// # Returns
///
/// * `Result<(), Box<EvalAltResult>>` - Ok if registration was successful, Err otherwise
pub fn register_virt_module(engine: &mut Engine) -> Result<(), Box<EvalAltResult>> {
    // Register Buildah module functions
    buildah::register_bah_module(engine)?;
    
    btrfs::register_btrfs_module(engine)?;

    nerdctl::register_nerdctl_module(engine)?;

    // Register RFS module functions
    rfs::register_rfs_module(engine)?;

    // Register QCOW2 module functions
    qcow2::register_qcow2_module(engine)?;

    // Register Cloud Hypervisor module functions
    cloudhv::register_cloudhv_module(engine)?;
    
    Ok(())
}

pub use buildah::{bah_new, register_bah_module, Bah, bah_fluent_new_with_executor};
pub use btrfs::register_btrfs_module;
pub use nerdctl::register_nerdctl_module;
pub use rfs::register_rfs_module;
pub use qcow2::register_qcow2_module;
pub use cloudhv::register_cloudhv_module;
