use crate::modules::monitoring::alert_rule::prometheus_alert_rule::PrometheusAlertRule;

pub fn global_storage_status_degraded_non_critical() -> PrometheusAlertRule {
    PrometheusAlertRule::new("GlobalStorageStatusNonCritical", "globalStorageStatus == 4")
        .for_duration("5m")
        .label("severity", "warning")
        .annotation(
            "description",
            "- **system**: {{ $labels.instance }}\n- **Status**: nonCritical\n- **Value**: {{ $value }}\n- **Job**: {{ $labels.job }}",
        )
        .annotation("title", " System storage status is in degraded state")
}

pub fn alert_global_storage_status_critical() -> PrometheusAlertRule {
    PrometheusAlertRule::new(
        "GlobalStorageStatus critical",
        "globalStorageStatus == 5",
    )
    .for_duration("5m")
    .label("severity", "warning")
    .annotation("title", "System storage status is critical at {{ $labels.instance }}")
    .annotation(
        "description",
        "- **System**: {{ $labels.instance }}\n- **Status**: Critical\n- **Value**: {{ $value }}\n- **Job**: {{ $labels.job }}",
    )
}

pub fn alert_global_storage_status_non_recoverable() -> PrometheusAlertRule {
    PrometheusAlertRule::new(
        "GlobalStorageStatus nonRecoverable",
        "globalStorageStatus == 6",
    )
    .for_duration("5m")
    .label("severity", "warning")
    .annotation("title", "System storage status is nonRecoverable at {{ $labels.instance }}")
    .annotation(
        "description",
        "- **System**: {{ $labels.instance }}\n- **Status**: nonRecoverable\n- **Value**: {{ $value }}\n- **Job**: {{ $labels.job }}",
    )
}
