use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use super::finding::{LintFinding, lint_product_group_data};
use crate::product_group::ProductGroupData;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LintResult {
pub pack_version: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub findings: Vec<LintFinding>,
pub assessed_at: DateTime<Utc>,
}
impl LintResult {
#[must_use]
pub fn compute(data: &ProductGroupData) -> Self {
let now = Utc::now();
Self {
pack_version: dpp_rules::lint::LINT_PACK_VERSION.to_owned(),
findings: lint_product_group_data(data, now),
assessed_at: now,
}
}
}