use super::{Substrate, SubstrateCommand, SubstrateError, SubstrateResult};

/// Dry-run substrate — records calls but never spawns processes.
#[derive(Default)]
pub struct NullSubstrate {
    pub recorded: std::sync::Mutex<Vec<SubstrateCommand>>,
}

impl Substrate for NullSubstrate {
    fn execute(&self, cmd: SubstrateCommand) -> Result<SubstrateResult, SubstrateError> {
        self.recorded.lock().unwrap().push(cmd);
        Ok(SubstrateResult {
            stdout: b"[dry-run: no output]".to_vec(),
            stderr: Vec::new(),
            exit_code: 0,
            duration_ms: 0,
        })
    }

    fn is_available(&self) -> bool {
        true
    }
}
