use anyhow::Result;
use time::OffsetDateTime;
use crate::contracts::{QueueFile, TaskStatus};
use super::report::build_aging_report;
use super::thresholds::AgingThresholds;
pub(crate) fn print_aging(
queue: &QueueFile,
statuses: &[TaskStatus],
thresholds: AgingThresholds,
format: super::super::shared::ReportFormat,
) -> Result<()> {
let now = OffsetDateTime::now_utc();
let report = build_aging_report(queue, statuses, thresholds, now);
match format {
super::super::shared::ReportFormat::Json => super::super::shared::print_json(&report)?,
super::super::shared::ReportFormat::Text => super::render::print_text_report(&report),
}
Ok(())
}