use crate::report::Severity;
use std::collections::HashMap;
use std::sync::LazyLock;
#[derive(Debug, Clone, Copy)]
pub struct RuleMeta {
pub rule_id: &'static str,
pub category: &'static str,
pub severity: Severity,
pub message_template: &'static str,
pub authority: &'static str,
pub authority_ref: &'static str,
pub explanation: &'static str,
pub inspects: &'static [&'static str],
pub auto_fixable: bool,
pub confidence: &'static str,
pub guide_section: &'static str,
pub guide_url: Option<&'static str>,
}
include!(concat!(env!("OUT_DIR"), "/catalogue_data.rs"));
static RULES_BY_ID: LazyLock<HashMap<&'static str, &'static RuleMeta>> =
LazyLock::new(|| RULES.iter().map(|r| (r.rule_id, r)).collect());
pub fn lookup(rule_id: &str) -> Option<&'static RuleMeta> {
RULES_BY_ID.get(rule_id).copied()
}
pub fn all_rules() -> &'static [RuleMeta] {
RULES
}
pub fn categories() -> &'static [&'static str] {
CATEGORIES
}