use super::ReportGenerator;
use crate::core::{AuditResult, ForgeGuardError};
use std::path::Path;
pub struct JsonReport;
impl ReportGenerator for JsonReport {
fn generate(&self, result: &AuditResult) -> Result<String, ForgeGuardError> {
Ok(serde_json::to_string_pretty(result)?)
}
fn extension(&self) -> &'static str {
"json"
}
}
pub fn write_report(result: &AuditResult, path: &Path) -> Result<(), ForgeGuardError> {
let json = serde_json::to_string_pretty(result)?;
std::fs::write(path, json)?;
Ok(())
}