use super::Report;
pub struct ReportFormatter;
impl ReportFormatter {
pub fn to_json(report: &Report) -> serde_json::Result<String> {
serde_json::to_string_pretty(&report)
}
pub fn to_markdown(report: &Report) -> String {
format!(
"# {}\n\n**Generated:** {}\n**Program:** {}\n\n## Summary\n- Invariants Checked: {}\n- Violations: {}\n- Coverage: {}%\n",
report.title,
report.generated_at,
report.program,
report.invariants_checked,
report.violations_found,
report.coverage_percent
)
}
pub fn to_cli_table(report: &Report) -> String {
format!(
"┌─────────────────────────────────────────┐\n│ {} (Coverage: {}%) │\n├─────────────────────────────────────────┤\n│ Invariants: {} | Violations: {} │\n└─────────────────────────────────────────┘\n",
report.program, report.coverage_percent, report.invariants_checked, report.violations_found
)
}
}