use std::collections::HashMap;

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

pub fn alert_deployment_unavailable() -> PrometheusAlertRule {
    PrometheusAlertRule {
        alert: "DeploymentUnavailable".into(),
        expr: "kube_deployment_status_replicas_unavailable > 0".into(),
        r#for: Some("2m".into()),
        labels: HashMap::from([("severity".into(), "warning".into())]),
        annotations: HashMap::from([
            (
                "summary".into(),
                "Deployment has unavailable replicas".into(),
            ),
            (
                "description".into(),
                "A deployment in this namespace has unavailable replicas for over 2 minutes."
                    .into(),
            ),
        ]),
    }
}
